Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology
Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered
You are not logged in.
hello when I use ftoi on this float:
-0.998224
I get
0
when I use ftori on the same float, -0.998224, I get
0
what .pkg can i use from the os3d or scol repository that rounds a negative number between - x.5y (where x is any number, or y, or a digit further to the right of y, is more than 0), to -x -1 , and which will round a positive x.5y (where x is any number, or y, or a digit further to the right of y, is more than 0) to x+1
thanks!
-Dan
Offline
i think there is a typo in tools.pkg, which reads
fun ftori(val)=
if (val >=. 0.0) then
ftoi (val +. 0.5)
else
ftoi (val -. 0.5);;
if i change it to:
fun ftori(val)=
if (val >=. 0.0) then
ftoi (val +. 0.5)
else
ftoi (val -. 0.5);;
the negative integer rounds (down) correctly for what i want to do in my code
Offline