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.

Russell [EMAIL PROTECTED]
----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 18, 1999 8:00 PM
Subject: [REBOL] Round function


> ; It's fairly basic, but does the job.
> 
> Round: func [R [integer! decimal!]] [
> to-integer either 0.5 <= remainder R 1 [R + 1][R]
> ]
> 
> Any one got any other maths functions?
> 
> Andrew Martin
> [EMAIL PROTECTED]
> http://members.xoom.com/AndrewMartin/
> Online @ 33,600 Baud!
> -><-
> 
> 

Reply via email to