Re: round
- Posted by Rolf Schroeder <r.schr at T-ONLINE.DE> Jun 05, 2000
- 585 views
©koda wrote:
>
>    Part 1.1    Type: Plain Text (text/plain)
>            Encoding: quoted-printable
How about:
--------------------------------
function round(atom a)
    if a < 0 then
        return floor(a - 0.5)
    else
        return floor(a + 0.5)
end function
--------------------------------
 a =  1.3 --> round(a) :  1
 a =  1.5 --> riund(a) :  2
 a =  1.7 --> round(a) :  2
 a = -0.3 --> round(a) :  0
 a = -0.5 --> round(a) : -1
 a = -0.7 --> round(a) : -1
Have a nice day, Rolf
	
 
		
