It's using a shorter way of sprintf.
>> i = 5.546
=> 5.546
>> ("%.2f" % i).to_f
=> 5.55
the .2 says 2 points after the decimal point.
If you want you can wrap it up in method and extend the Float class.
Internet, Life and what's between - חיים, אינטרנט ומה שביניהם
'what I see, is what you get'
>> i = 5.546
=> 5.546
>> ("%.2f" % i).to_f
=> 5.55
1 comments:
Wow, nice post,there are many person searching about that now they will find enough resources by your post.Thank you for sharing to us.Please one more post about that..
Post a Comment