INT, FIX (Integer, Fix Integer)

The INT and FIX functions are used to return the integer portion of a number.

Syntax

INT ( number )

FIX ( number )

Remarks

The Number argument can be any valid numeric expression. Both INT and FIX remove the fractional part of number and return the resulting integer value.

If the numeric expression results in a Null value, INT and FIX return a ClosedNAN Not a number. A data word indicating a measurement or processing error. Voltage overrange, SDI-12 sensor error, and undefined mathematical results can produce NAN..

The difference between INT and FIX is that if number is negative, INT returns the first negative integer less than or equal to the Number argument, whereas FIX returns the first negative integer greater than or equal to the Number. For example, INT converts -8.4 to -9, and FIX converts -8.4 to -8.

FIX(number) is equivalent to:

SGN(number) * INT(ABS(number))