[Newbies] How to round a float?
Chuck Hipschman
ckhipschman at gmail.com
Wed Feb 4 11:22:20 UTC 2015
7 / 8.0 roundTo 0.01 = 0.88 Aha! Thanks!
But:
100 * (1.05 raisedTo: 10) roundTo: 0.01 162.89000000000001
"162.88946267774418" "unrounded"
100 * (1.05 raisedTo: 15) roundTo: 0.01 207.89000000000001
"207.8928179411367" "unrounded"
Bug, or me again :-)
MacBook Pro (Retina, 15-inch, Early 2013) System Version: OS X 10.10.2
(14C109)
Image
-----
/Users/chuck/Downloads/Squeak-4.5-All-In-One/Squeak-4.5-All-in-One.app/Contents/Resources/Squeak4.5-13680.image
Squeak4.5
latest update: #13680
Current Change Set: Unnamed1
Image format 6505 (32 bit)
Virtual Machine
---------------
/Users/chuck/Downloads/Squeak-4.5-All-In-One/Squeak-4.5-All-in-One.app/Contents/MacOS/Squeak
Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.331] 4.5
Mac OS X built on Aug 22 2013 10:08:05 Compiler: 4.2.1 (Apple Inc. build
5666) (dot 3)
platform sources revision VM: r2776
http://www.squeakvm.org/svn/squeak/branches/Cog Plugins: r2545
http://squeakvm.org/svn/squeak/trunk/platforms/Cross/plugins
CoInterpreter VMMaker.oscog-eem.331 uuid:
37d2e4b0-2f37-4e2d-8313-c63637785e59 Aug 22 2013
StackToRegisterMappingCogit VMMaker.oscog-eem.333 uuid:
84da9cb8-7f30-4cb7-b4fb-239a11f63b54 Aug 22 2013
On Wed, Feb 4, 2015 at 2:59 AM, Ben Coman <btc at openinworld.com> wrote:
> In the interest of teaching how to fish, look at the senders of #roundTo:
> to find its usage.
>
> I'll post a full answer tomorrow if you don't beat me to it.
>
> cheers -ben
>
> On Wed, Feb 4, 2015 at 4:34 PM, Chuck Hipschman <ckhipschman at gmail.com>
> wrote:
>
>> 7 / 8.0 roundTo: 2 I expect 0.88, I get 0
>>
>> What am I doing wrong, or this a bug?
>>
>> TIA
>>
>> Chuck
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20150204/fb67740d/attachment.htm
More information about the Beginners
mailing list