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.
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.
2. Use function Ceil to find the number rounded up to a multiple of the threshold.
Functions floor and Floor
1. Use function floor to find the number rounded down to the nearest whole number.
2. Use function Floor to find the number rounded down to a multiple of the threshold.
3. Use function Floor to find the number rounded down to the nearest multiple of 1.
 When the threshold equals 1, functions Floor and floor return the same result.
4. Use function Floor to round a number with units:
 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.
The lowercase versions of these functions do not accept arguments with units.
6. Use function floor to retrieve the decimal part of the number.
Functions round and Round
1. Use function round to get the number rounded to a specified number of digits.
2. Use function Round to get the number rounded to a particular threshold.
3. Use function Round with units and specify a multiplier to specify the number of places in the result when expressed in that unit.
4. Show that the following constructs are equivalent:
5. Show the relationship between functions round and Round:
Functions trunc and Trunc
1. Use function trunc to find the number truncated to a whole number.
2. Use function Trunc to find the number truncated to a multiple of the threshold.
3. Show the relationship between functions trunc and Trunc:
Truncation and Precision
1. On the Math Formatting tab, in the Results group, click Show Trailing Zeros.
2. Type the following expressions:
3. Evaluate d:
4. Change the display precision to 5 and reevaluate d:
5. Use function Trunc to truncate d to a multiple of the threshold: