|
Purpose |
Rounds a double-precision number to the specified accuracy | ||
|
Old name |
#define round_number tf_round_number | ||
|
Syntax |
double tf_round_number(number, decimal_places) | ||
|
Parameters |
double number |
Number to round | |
|
|
int decimal_places |
Required accuracy, as a number of decimal places | |
|
Description |
The tf_round_number() function rounds the given number to the specified number of decimal places. If the value of the digit in the decimal place after that given by the parameter decimal_places is greater than or equal to 5, the previous digit is incremented by 1. For example, the call: tf_round_number(3.149, 2); returns 3.15. The call: tf_round_number(3.999, 2) returns 4.00. | ||
|
Return values |
Returns the rounded double-precision number | ||
|
See also |
|||
|
Example |
| ||