eris.decimal.rounding

Rounding methods for floating-point decimal arithmetic.

Members

Functions

clipZeros
int clipZeros(BigInt n, uint digits)

Trims any trailing zeros and returns the number of zeros trimmed.

countDigits
int countDigits(T m)

Returns the number of decimal digits in a non-negative big integer

firstDigit
uint firstDigit(T n)

returns the first decimal digit of the number

lastDigit
int lastDigit(BigInt big)

Returns the last digit of the argument.

round
D round(D num)

Returns the number rounded to its type precision. Flags: SUBNORMAL, CLAMPED, OVERFLOW, INEXACT, ROUNDED.

round
D round(D num, Context context, bool setFlags)

Rounds the number to the precision of the context parameter. if setFlags is false no context flags will be set by this operation. Returns the rounded number. Flags: SUBNORMAL, CLAMPED, OVERFLOW, INEXACT, ROUNDED.

round
D round(D num, int precision, Round mode, bool setFlags)

Rounds the number to the specified precision using the specified rounding mode. if setFlags is false none of the context flags will be set by this operation. Flags: SUBNORMAL, CLAMPED, OVERFLOW, INEXACT, ROUNDED.

roundStr
string roundStr(string str, int precision)

Returns a numeric string with the specified precision.

shiftBig
BigInt shiftBig(BigInt num, int n)

Decimal shift left. Shifts the number left by the specified number of decimal digits. If n == 0 the number is returned unchanged. If n < 0 the number is shifted right.

trailingZeros
uint trailingZeros(BigInt n, uint digits)

Returns the number of trailing zeros in the argument.

Meta

Authors

Paul D. Anderson

Standards

General Decimal Arithmetic Specification, Version 1.70, (25 March 2009).

License

<a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>