Skip to main content

Fix function (LotusScript Language)

Returns the integer part of a number.

Syntax

Fix ( numExpr )

Elements

numExpr

Any numeric expression.

Return value

Fix returns the value of its argument with the fractional part removed. The data type of the return value is determined by the data type of numExpr. The following table shows special cases.

numExprReturn value
NULLNULL
Variant containing a string interpretable as a numberDouble
Variant containing a date/time valueThe date part of the value

Usage

The Fix function rounds toward 0:

  • For a positive argument, Fix returns the nearest integer less than or equal to the argument (if the argument is between 0 and 1, Fix returns 0).
  • For a negative argument, Fix returns the nearest integer larger than or equal to the argument (if the argument is between 0 and -1, Fix returns 0).

The Fix function and the Int function behave differently. The return value from Int is always less than or equal to its argument.

Tip: It is always true that Fix(numExpr) + fraction(numExpr) = numExpr.

Example