Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
virtual P6R::P6ERR P6R::p6IMathlib::roundHalfToEven ( P6FLOAT  withDecimal,
P6INT32  precision,
P6FLOAT pRound 
)
pure virtual

This method performs rounding to a specified number of decimal points (i.e., the precision parameter).

Rounding is done so that an even value is selected if the two possible values are equally close. This type of rounding is also known as: unbiased rounding, convergent rounding, statistician's rounding, or Gaussian rounding. The following are examples of this method in use:

* roundHalfToEven( 2.5, 0 ) results in 2.0
* roundHalfToEven( 273.12, -1 ) results in 270.00
* roundHalfToEven( 1.1742, 2 ) results in 1.17
*
Parameters
withDecimal[ in ] A numeric value with a value after the decimal point (e.g., 4.6)
precision[ in ] Indicates the number of decimal digits required after the decimal point. The "withDecimal" parameter is rounded to a multiple of 10 to the power -precision. For example, if this parameter is 2 then withDecimal is rounded to a multiple of 0.01. If precision is 0 then withDecimal is rounded to a multiple of 1, thus to an integer. Lastly, if precision is negative, for example -2, then withDecimal is rounded to a multiple of 100. Negative precision will also set all decimal digits to zero.
pRound[ out ] see examples above
Returns
SuccessP6R::eOk 
FailureP6R::eInvalidArgOne of the parameters is NULL or inSize is zero.
P6R::eNotInitializedA successful call to initialize has not been done.