[Newbies] How to round a float?

Louis LaBrunda Lou at Keystone-Software.com
Wed Feb 18 15:27:55 UTC 2015


Hi Bert,

>> That's why I thought there was a problem with #roundTo: but maybe #roundTo:
>> has some other intent that I'm not aware of?
>
>It's used for snapping values to a grid. E.g. in ScrollBar>>setValue:.
>- Bert -

Ahh, Thanks Bert.  So it isn't exactly the same as displaying the numbers
but close.  And in that case I guess a value like 162.89000000000001 is
good enough and there wouldn't be any growing error as each snap brings the
value back where you want it.

Lou
-----------------------------------------------------------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou at Keystone-Software.com http://www.Keystone-Software.com



More information about the Beginners mailing list