nint

 

Description

Return the closest int to the double argument.

The arithmetic is same with c/c++, but not same with Excel.

Syntax

int nint( double x )

Parameters

x
[input] double value the nearest integer to which is sought.

Return

the nearest integer to x

Examples

EX1

void    nint_ex1()
{
    double    r1 = 3.6;
    double    r2 = 3.4;
    
    printf("nearest integer to %f is %d\nnearest integer to %f is %d\n", r1, nint(r1), r2, nint(r2));
}

Remark

See Also

nint2

header to Include

origin.h

Reference