Description
Fix truncates a number to the specified number of decimal places and returns it.
Arguments
number is the Number value to be truncated; it can be positive, 0 or negative.
#places is an optional Number indicating the number of decimal places to be truncated to. If omitted, 0 is assumed.
Returns
Whole number value which can be positive, 0 or negative.
Action
If #places is omitted, 0 is assumed.
Examples
Fix (123.678)
Returns 123.
Fix (-123.678)
Returns -123.
Fix (123.678,1)
Returns 123.6.
Fix (123.678,2)
Returns 123.67.
Comments
Fix (n) and
Int (number) work the same except when n is negative, in which case Fix returns the first integer greater than or equal to n, and Int returns the first integer smaller than or equal to n. For example,
Fix (-10.2)
Returns -10.
Int (-10.2)
Returns -11.
Fix and
Truncate are equivalent functions.