Parameter | Type | Description |
---|---|---|
NUMBER | VALUE(FLOAT) | The input value. |
PLACE | VALUE(INTEGER) | The place to round to. |
VALUE(FLOAT) | The input value, rounded to the nearest chosen place. |
This function takes a numeric value and rounds it to the nearest designated place. The PLACE parameter's value determines that place: 0 for whole numbers, positive values for each place after the decimal point (1 is tenths, 2 is hundredths, ...), and negative values for places before it (-1 is tens, -2 is hundreds, ...). The input value is interpreted as a floating-point number, and the place value is interpreted as an integer.
a = fix(15.25, 0); // a = 15.0
a = fix(15.25, -1); // a = 20.0
a = fix(15.25, 1); // a = 15.3
Calling fix(X, 0) is equivalent to:
round(X)