[Newbies] Rouding Floats up to a number of decimals - Method Finder

cdrick cdrick65 at gmail.com
Wed Jul 23 14:34:10 UTC 2008


>
> Float has a truncate and round off protocal with metods that truncate
> and round to integer.
>
> So it looks you have to do something like
>
> (aFloat * (10^desiredDecimals) + 0.5) truncated / (10^desiredDecimals)
>
> or without the + 0.5 for truncation.
>


close to what I proposed earlier ;-)  Just need a conversion to Float
as it returns a fraction.

so no existing method... Isn't it something common ?


More information about the Beginners mailing list