Int, Fix Functions

Language Items List

Definition:

Return the integer portion of the supplied number.

Syntax:

Int(number)

Fix(number)


Syntax Description


number Any numeric expression

Details:

Both Int and Fix round the fractional part of number and return the nearest integer.

Int and Fix handle positive non-fractional numbers in the same way. Negative fractional numbers are handled differently. Int returns the first whole negative number that is less than or equal to the supplied expression. Fix, on the other hand, returns the first whole negative number greater than or equal to the supplied expression. The following table illustrates the similarities and differences.


Number Int Fix


3 3 3

-3 -3 -3

3.4 3 3

-3.4 -4 -3

3.8 3 3

-3.8 -4 -3

Fix(number) is equivalent to:

Sgn(number) * Int(Abs(number))