Yudi Soesanto wrote:
> How i can store integer data type and when application display the data
> back
> (Since it will do calculation) it will display float on each column
> points,
> assists, blocks and turnovers?
This seems to be a basic Ruby question. See the following IRB session:
>> x = 25
=> 25
>> y = 3
=> 3
>> z = x / y
=> 8
>> z = x.to_f / y.to_f
=> 8.33333333333333
>> puts "%0.3f" % z
8.333
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment