Obtaining the whole part of a number
by Tim Saunders · in Torque Game Builder · 11/26/2007 (5:31 am) · 4 replies
How do I get the whole part of a number and ignore the decimal places in Torque script? I've checked through the documentation, but no joy so far.
About the author
#2
mFloor() or mCeil()
mFloor always rounds down (x>=1 x<2) = 1
mCeil always rounds up (x>1 x<=2) = 2
and for negatives
mFloor (x<=-1 x>-2) = -1
mCeiling (x<-1 x>=-2) = -2
Gabriel
11/26/2007 (7:34 am)
Try mFloor() or mCeil()
mFloor always rounds down (x>=1 x<2) = 1
mCeil always rounds up (x>1 x<=2) = 2
and for negatives
mFloor (x<=-1 x>-2) = -1
mCeiling (x<-1 x>=-2) = -2
Gabriel
#3
11/26/2007 (7:52 am)
Hey thanks that's exactly what I was after.
#4
You can also use mRound(%value). There are some other great general math functions listed in the HTML docs under Reference/General Math.
11/28/2007 (5:00 am)
Tim,You can also use mRound(%value). There are some other great general math functions listed in the HTML docs under Reference/General Math.
Torque Owner Tim Saunders
%Number = mFloatLength(%Number, 0);
This reduces the number of decimal places in a float to zero.