Functions > Utility Functions > Example: Truncation and Roundoff Functions
Example: Truncation and Roundoff Functions
Use the ceil, Ceil, floor, Floor, round, Round, trunc, and Trunc functions to truncate and roundoff numbers.
* 
All truncation and round–off functions can also be evaluated symbolically.
1. Define a threshold and a complex number. The variable z below can be real or complex.
Click to copy this expression
Click to copy this expression
2. On the Math Formatting tab, in the Results group, click Display Precision and select 15.
Functions ceil and Ceil
1. Use function ceil to find the number rounded up to the nearest whole number.
Click to copy this expression
2. Use function Ceil to find the number rounded up to a multiple of the threshold.
Click to copy this expression
Functions floor and Floor
1. Use function floor to find the number rounded down to the nearest whole number.
Click to copy this expression
2. Use function Floor to find the number rounded down to a multiple of the threshold.
Click to copy this expression
3. Use function Floor to find the number rounded down to the nearest multiple of 1.
Click to copy this expression
* 
When the threshold equals 1, functions Floor and floor return the same result.
4. Use function Floor to round a number with units:
Click to copy this expression
Click to copy this expression
* 
When rounding numbers involving units, use a united expression as your threshold to ensure you always get the same result no matter what unit system your worksheet uses.
5. Use the units placeholder in the result to display the solution in the units you want.
Click to copy this expression
Click to copy this expression
The lowercase versions of these functions do not accept arguments with units.
6. Use function floor to retrieve the decimal part of the number.
Click to copy this expression
Click to copy this expression
Functions round and Round
1. Use function round to get the number rounded to a specified number of digits.
Click to copy this expression
Click to copy this expression
2. Use function Round to get the number rounded to a particular threshold.
Click to copy this expression
3. Use function Round with units and specify a multiplier to specify the number of places in the result when expressed in that unit.
Click to copy this expression
Click to copy this expression
4. Show that the following constructs are equivalent:
Click to copy this expression
Click to copy this expression
Click to copy this expression
5. Show the relationship between functions round and Round:
Click to copy this expression
Click to copy this expression
Click to copy this expression
Functions trunc and Trunc
1. Use function trunc to find the number truncated to a whole number.
Click to copy this expression
2. Use function Trunc to find the number truncated to a multiple of the threshold.
Click to copy this expression
3. Show the relationship between functions trunc and Trunc:
Click to copy this expression
Click to copy this expression
Click to copy this expression
Truncation and Precision
1. On the Math Formatting tab, in the Results group, click Show Trailing Zeros.
2. Type the following expressions:
Click to copy this expression
Click to copy this expression
3. Evaluate d:
Click to copy this expression
4. Change the display precision to 5 and reevaluate d:
Click to copy this expression
5. Use function Trunc to truncate d to a multiple of the threshold:
Click to copy this expression
Click to copy this expression
Was this helpful?