Returns the integer part of a number, rounding towards zero
Syntax
Usage
result = Fix( number )
Parameters
number
the floating-point number to truncate
Return Value
Returns the integer part of number, rounding towards zero.
Description
Equivalent to:
Sgn(number) * Int(Abs(number)). For example,
Fix(1.3) will return
1.0, and
Fix(-4.9) will return
-4.0. For integer types, the number is returned unchanged.
Note: this function is also equivalent to
number - Frac(number).
The
Fix unary
Operator can be overloaded with user defined types.
Example
Print Fix(1.9) '' will print 1
Print Fix(-1.9) '' will print -1
Dialect Differences
- In the -lang qb dialect, this operator cannot be overloaded.
Differences from QB
See also