Description

Returns an integer numeric value, when calculating an expression.

Syntax

integer = Int (expression)

Parameters

The Int function has the following parameters.

ParameterDescription
ExpressionMay yield any numeric value. Int truncates any fractional portion of an expression. Arithmetic operations that are specified are calculated using 15 digit accuracy, but Int truncates, not rounds, the decimal fraction. In the following example:

MILES = Int (59.99)

the value of 59 is assigned to MILES.

If X is any number, then Int(X) is the largest integer less than or equal to X.

ExpressionResult
Int(6.23)6
Int(9.99)9
Int(100.001)100
Int(-6.3)-7

To convert X from dollars to cents, the following expression can be used:

CENTS = Int(X*100)

All truncations are toward the minus infinity.

See also

Seq()

Example

* This determines if NUMBER is evenly divisible by DIVISOR
If (NUMBER / DIVISOR) = Int(NUMBER / DIVISOR) Then
       Call Msg("", NUMBER: " is evenly divided by ": DIVISOR)
End
* round value
value = int(value + .5)
  • No labels