Caché MultiValue Basic Reference
FIX
[Back] [Next]
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Returns a floating point number with the specified number of decimal digits.
Synopsis
FIX(number[,precision[,mode]])
Arguments
number An expression that resolves to a number or a numeric string.
precision Optional — An expression that resolves to an integer specifying the number of decimal digits of precision. The default is 4.
mode Optional — An expression that resolves to a boolean flag that specifies whether to round or truncate number. 0=round; 1=truncate. The default is 0.
Description
The FIX function takes a floating point number and returns this number rounded or truncated to the specified number of fractional digits. The precision is the maximum number of fractional digits. FIX does not pad a number with trailing zeros, and removes trailing zeros that result from the rounding process. Thus FIX(12.99,1) returns 13, not 13.0.
The precision argument is optional. If not specified, FIX either takes its precision from a preceding PRECISION command, or takes the default precision of 4. A value of 0, the null string, or a non-numeric string does not set precision, and the default precision is taken. You must specify a precision value to specify a mode value.
Examples
The following example shows the uses of the FIX function:
PRINT FIX(123.987654);      ! Returns 123.9877
PRINT FIX(123.987654,2);    ! Returns 123.99
PRINT FIX(123.987654,1);    ! Returns 124
PRINT FIX(123.987654,0);    ! Returns 123.9877
PRINT FIX(123.987654,2,0);  ! Returns 123.99
PRINT FIX(123.987654,2,1);  ! Returns 123.98
See Also