[Newbies] Rouding Floats up to a number of decimals -
mm3 at zepler.net
Wed Jul 23 14:47:37 UTC 2008
Why is it important to you to have a float? Once you've truncated it, you
have a rational number, by definition.
Are you sure you want to truncate the number, rather than performing the
truncation in the presentation layer?
On Wed, Jul 23, 2008 at 10:34 AM, cdrick <cdrick65 at gmail.com> wrote:
> > 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 ?
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners