AdjustValue

Real value formatting

double AdjustValue(
        const double    value,
        const int               digitInteger,
        const int               digitDecimal
)

Parameters
value
Real value to format
digitInteger
Digits of integer (1 to 9)
digitDecimal
Digits of decimal (0 to 9)

Return Value
NORMAL(0): Successful completion
ERROR(-1): Unsuccessful completion

Description
Formats the given real value into the specified digits of integer/decimal.
Specifically, it performs rounding to the maximum/minimum values and rounding-off processing.
With 9 digits integer + 4 digits decimal, the maximum/minimum values will be as follows.
Maximum: 999,999,999.9999
Minimum: -999,999,999.9999
Since the precision of rounding off depends on the precision of double, note that you cannot obtain a correct real value with such values as 9-digit integers and 9-digit decimals.

Notes