Int

int returns the integer part of a number.

Syntax

   int(NUMERIC_EXPR)
  • NUMERIC_EXPR is an expression returning a numeric value.

Examples

   FRAC_PI=pi-int(pi)  :# returns 0.14159265358...
   X = int(-pi)        :# X = -4
   Y = int(-5)         :# Y = -5

Description

int(X) returns:

  • fix(X) : if 'X' is positive, null or integer;
  • fix(X)-1 : if 'X' is strictly negative and not integer.

The type of result is Integer or Decimal depending whether the result is in the [ -2^31, 2^31-1 ] range.

Associated errors

Error code Description
10 The argument is not numeric.

See also

fix, ar2, arr, Integer, mod.