Russell wrote: > If you like one-liners, how about: > > >> round: func [n][print to-integer n + either n < 0 [-.5][.5]] > > This prints integer closest to n. > I am sorry, but this is wrong, too: round -0.5 should be 0 and not -1. Try to compare with these: floor: func [x [number!] /local y] [(y: to-integer x) - to-integer x < y] round: func [x [number!]] [floor x + 0.5] or, as a one-liner: round: func [x [number!] /local y z] [(y: to-integer z: (x + 0.5)) - to-integer z < y] Ladislav
- [REBOL] Round function Al . Bri
- [REBOL] Round function Re: rryost
- [REBOL] Round function Re:(2) KSMiTH
- [REBOL] REBOL and the Bazaar! xmldiva
- [REBOL] Round function Re: rryost
- [REBOL] Round function Re:(2) lmecir
- [REBOL] Round function Re:(2) ddalley
