2.1.24.4.40 ocmath_round_with_tolerance


Description

Roundup input data array.

Syntax

int ocmath_round_with_tolerance( int nSize, double * pData, double dTol )

Parameters

nSize
[input] size of input array pData.
pData
[modify] on input, it contains data array to be rounded;
on output, it contains rounded data array in asending order.
dTol
[input] tolerance used when roundup pData.

Return

Return OE_NOERROR if succeed, otherwise, non-zero error code is returned.

Examples

EX1

void ocmath_round_with_tolerance_ex1()
{
    vector vTest = {0.1, 0.3, 0.5, 0.55, 0.6, 1.1, 2.001};
    int nRet = ocmath_round_with_tolerance(vTest.GetSize(), vTest, 0.2);
}
// At the end of example:
// vTest = {0, 0.2, 0,4, 0,6, 0,6, 1.2, 2};

Remark

This function roundup input data array.

First, calls ocmath_round_range to calculate the number of Bins, and every bin's round increment is dTol,

then use g01aec to get bins' boundaries, the roundup data is pData[ii] = vBoundary[jj-1]+dTol/2

where jj is bins' number.

See Also

ocmath_round_range

Header to Include

origin.h

Reference

nag_frequency_table(g01aec)nag_frequency_table(g01aec), Nag Manual