CitectVBA Programming Reference > CitectVBA Function Reference > Math/Trigonometry Functions > Fix

Fix

Calculates the integer portion of a number. Fix does not round the number, and ignores the fractional value of the number.

Fix expects the argument (Num) to be a valid numeric value. If the argument value is positive, rounds the Num down by dropping any fractional value. If the argument value is negative, rounds the Num up to the next integer number greater than or equal to Num.

Do not confuse Fix with Int , which rounds a negative argument value (Num) down to the next integer number less than or equal to Num.

Syntax

Fix(Num)

Num:

An Integer or expression representing a valid numeric value.

Return Value

Returns the Integer value of the number (Num) provided in the argument.

Related Functions

Abs | Int | Sgn | Sqrt

Example

Dim vntVar
vntVar = Fix(99.2) ' returns 99
vntVar = Fix(99.8) ' returns 99
vntVar = Fix(-99.8) ' returns -99
vntVar = Fix(-99.2) ' returns -99