[Newbies] Re: Rouding Floats up to a number of decimals - Method
Finder
Zulq Alam
me at zulq.net
Wed Jul 23 15:24:17 UTC 2008
Are #truncateTo: and #roundTo: what you want?
1.2288 roundTo: 1 "1"
1.2288 roundTo: 0.1 "1.2"
1.2288 roundTo: 0.01 "1.23"
1.2288 roundTo: 0.001 "1.229"
1.2288 roundTo: 0.0001 "1.2288"
1.2288 roundTo: 0.05 "1.25"
1.2288 roundTo: 0.002 "1.228"
1.2288 truncateTo: 1 "1"
1.2288 truncateTo: 0.1 "1.2"
1.2288 truncateTo: 0.01 "1.22"
1.2288 truncateTo: 0.001 "1.228"
1.2288 truncateTo: 0.0001 "1.2288"
1.2288 truncateTo: 0.05 "1.2"
1.2288 truncateTo: 0.002 "1.228"
Z.
cdrick wrote:
>
> So anybody has an idea of methods that truncate/round Floats ?
More information about the Beginners
mailing list