[Glass] 10.12345 round: 2 => 10.12 ?
Mariano Martinez Peck
marianopeck at gmail.com
Fri Nov 15 06:20:16 PST 2013
Hi guys... mmmm In Pharo we have the message #round:. Here it is :
Float >> round: numberOfWishedDecimal
"only leave a fixed amount of decimal"
"10.12345 round: 2 => 10.12"
| v |
v := 10 raisedTo: numberOfWishedDecimal.
^ ((self * v) rounded / v) asFloat
I see in GemStone Float has #roundTo: but doesn't seem to answer the
same...
Is there an equivalent?
Thanks,
--
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20131115/6661522c/attachment.html>
More information about the Glass
mailing list