yes... rounding.r is nice... anyway, my routine works well enough for the
purpose I required... but it would be nice to see a rounding function
included in REBOL.
--Ralph
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 19, 2000 2:44 AM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] roundoff? Re:
>
>
> Hi,
>
> see also www.rebol.org/math/rounding.r
>
> > I needed a simple two decimal place round off function for a
> script this
> > evening.
> >
> > This is what I came up with:
> >
> > roundoff: func ["Rounds off to 2 decimal places" a][
> > a: a * 100
> > b: a - to-integer a
> > a: to-integer a
> > if b > .5 [a: a + 1]
> > a: divide a 100
> > ]
> >
> > Here's how it works:
> >
> > >> roundoff 10.567890
> > == 10.57
> > >> roundoff 10.563333
> > == 10.56
> >
> > Can anyone improve on this, or is there a function already in
> REBOL I
> > overlooked?
> >
> > Okay, yes, to-money does it:
> >
> > >> to-money 10.567
> > == $10.57
> > >> to-money 10.563
> > == $10.56
> >
> > but I want the decimal! type.
> >
> > --Ralph Roberts
> >
> >
> >
>