prec

 

Description

Calculates a double value which is equal to x up to nSignificantDigits significant digits

Syntax

double prec( double x, int nSignificantDigits )

Parameters

x
[input] independent variable
nSignificantDigits
[input] significant digits of x value

Return

x with the precision of nSignificantDigits significant digits.

Examples

EX1

void    prec_ex1()
{
    double        x = 34.56789;
    int            nSignificantDigits = 5;
    
    printf("prec(%f, %d) = %f", x, nSignificantDigits, prec(x, nSignificantDigits));
}

Remark

See Also

round

header to Include

origin.h

Reference