2.1.16.5.6 round


Description

force given value to be nDecimalPlaces

Syntax

double round( double x, UINT nDecimalPlaces )

Parameters

x
[input] independent variable
nDecimalPlaces
[input] decimal places of x

Return

x with nDecimalPlaces decimal places.

Examples

EX1

void    round_ex1()
{
    double        x = 34.56789;
    int            nDecimalPlaces = 3;
    
    printf("round(%f, %d) = %f", x, nDecimalPlaces, round(x, nDecimalPlaces));
}

Remark

Calculates a double value which is equal to x up to nDecimalPlaces decimal places

See Also

prec

Header to Include

origin.h

Reference