TomToad
Im not at my home PC so I cant try it but what if you did the following.
f/abs(f) should give either 1 or -1
go one further and f/abs(2*f) should give 0.5 or -0.5
so I think you can do :
i = f + (f / abs(f*2))
so you will either add or subtract 0.5 from f.
(I think)
[edit]
duh !
or you can just do an if statement
Local i:Int
Local f:Float
f= -2.4
if f < 0 then
i=f-0.5
else
i=f+0.5
end if
Print i
[/edit]
Im not at my home PC so I cant try it but what if you did the following.
f/abs(f) should give either 1 or -1
go one further and f/abs(2*f) should give 0.5 or -0.5
so I think you can do :
i = f + (f / abs(f*2))
so you will either add or subtract 0.5 from f.
(I think)
[edit]
duh !
or you can just do an if statement
Local i:Int
Local f:Float
f= -2.4
if f < 0 then
i=f-0.5
else
i=f+0.5
end if
Print i
[/edit]