eris.decimal

Floating-point decimal number and decimal arithmetic library for D.

An implementation of the General Decimal Arithmetic Specification.

Constructors

this
this(decimal that)
Undocumented in source.

Modules

arithmetic
module eris.decimal.arithmetic

Floating-point decimal arithmetic.

context
module eris.decimal.context

Arithmetic context for floating-point decimal arithmetic.

conv
module eris.decimal.conv

Conversion of floating-point decimals to/from strings.

logical
module eris.decimal.logical

Decimal logical functions.

math
module eris.decimal.math

Floating-point decimal mathematical functions.

rounding
module eris.decimal.rounding

Rounding methods for floating-point decimal arithmetic.

test
module eris.decimal.test

Test routines for floating-point decimal arithmetic.

Public Imports

std.bigint
public import std.bigint;
eris.decimal.context
public import eris.decimal.context;
eris.decimal.rounding
public import eris.decimal.rounding;
eris.decimal.arithmetic
public import eris.decimal.arithmetic;
eris.decimal.conv
public import eris.decimal.conv;

Members

Aliases

D16
alias D16 = Decimal!(Bid64)
Undocumented in source.
D9
alias D9 = Decimal!(TestContext)
Undocumented in source.
TD
alias TD = D16
Undocumented in source.

Functions

copy
decimal copy()

Returns a copy of the operand. The copy is unaffected by context and is quiet -- no flags are changed. Implements the 'copy' function in the specification. (p. 43)

copyAbs
decimal copyAbs()

Returns a copy of the operand with a positive sign. The copy is unaffected by context and is quiet -- no flags are changed. Implements the 'copy-abs' function in the specification. (p. 44)

copyNegate
decimal copyNegate()

Returns a copy of the operand with the sign inverted. The copy is unaffected by context and is quiet -- no flags are changed. Implements the 'copy-negate' function in the specification. (p. 44)

copySign
decimal copySign(decimal arg)

Returns a copy of the first operand with the sign of the second operand. The copy is unaffected by context and is quiet -- no flags are changed. Implements the 'copy-sign' function in the specification. (p. 44)

dup
decimal dup()

dup property

isCanonical
bool isCanonical()

Returns true if this number's representation is canonical.

isFinite
bool isFinite()

Returns true if this number is not an infinity or a NaN.

isInfinite
bool isInfinite()

Returns true if this number is + or - infinity.

isIntegralValued
bool isIntegralValued()

Returns true if the number is an integer (the fractional part is zero).

isNaN
bool isNaN()

Returns true if this number is a quiet or signaling NaN.

isNegative
bool isNegative()

Returns true if this number is negative. (Includes -0)

isNormal
bool isNormal(int minExponent)

Returns true if this number is normal.

isOne
bool isOne()

Returns true if this number is exactly one.

isPositive
bool isPositive()

Returns true if this number is positive. (Excludes -0)

isQuiet
bool isQuiet()

Returns true if this number is a quiet NaN.

isSignal
bool isSignal()

Returns true if this number is a signaling NaN.

isSimpleOne
bool isSimpleOne()

Returns true if this number is exactly (false, 1, 0).

isSpecial
bool isSpecial()

Returns true if this number is a NaN or infinity.

isSubnormal
bool isSubnormal(int minExponent)

Returns true if this number is subnormal.

isTrue
bool isTrue()

Returns true if this number is a true value. Non-zero finite numbers are true. Infinity is true and NaN is false.

isZero
bool isZero()

Returns true if this number is + or - zero.

nextAfter
decimal nextAfter(decimal x)

Returns the representable number that is closest to the this number (but not this number) in the direction toward the argument.

nextDown
decimal nextDown()

Returns the largest representable number that is smaller than this number.

nextUp
decimal nextUp()

Returns the smallest representable number that is larger than this number.

opAssign
void opAssign(T that)

Assigns a decimal number (makes a copy)

opAssign
void opAssign(T that)

Assigns an BigInt value.

opAssign
void opAssign(T that)

Assigns an boolean value.

opAssign
void opAssign(T that)

Assigns an value.

opAssign
void opAssign(T that)

Assigns a floating point value.

opAssign
void opAssign(T that)

Assigns a string value.

opBinary
decimal opBinary(D that)

Returns the result of the specified binary operation on this number and the argument.

opBinary
decimal opBinary(T x)

Returns the result of performing the specified binary operation on this number and the argument.

opBinaryRight
decimal opBinaryRight(T x)

Returns the result of performing the specified binary operation on this number and the argument.

opCmp
int opCmp(T that)

Returns -1, 0 or 1, if this number is less than, equal to, or greater than the argument, respectively. NOTE: The comparison is made to the current precision.

opCmp
int opCmp(T that)

Returns -1, 0 or 1, if this number is less than, equal to, or greater than the argument, respectively.

opEquals
bool opEquals(T that)

Returns true if this number is equal to the argument. Finite numbers are equal if they are numerically equal to the current precision. Infinities are equal if they have the same sign. Zeros are equal regardless of sign. A NaN is not equal to any number, not even to another NaN. A number is not even equal to itself (this != this) if it is a NaN.

opEquals
bool opEquals(T that)

Returns true if this number is equal to the argument.

opOpAssign
decimal opOpAssign(T x)

Performs the specified binary operation on this number and the argument then assigns the result to this number.

opOpAssign
decimal opOpAssign(T x)

Performs the specified binary operation on this number and the argument then assigns the result to this number.

opUnary
decimal opUnary()

Returns the result of the unary operation on this number.

pow10
U pow10(int n)

mixin template to create a constant at the type precision, with an option to create an arbitrary precision constant.

pow10b
BigInt pow10b(uint n)
Undocumented in source. Be warned that the author may not have intended to support it.
toAbstract
string toAbstract()

Converts a number to an abstract string representation.

toEngineering
string toEngineering()

Converts a number to an "engineering notation" string representation.

toFull
string toFull()

Converts a number to a full string representation.

toScientific
string toScientific()

Converts a number to a "scientific notation" string representation.

toString
string toString(string fmStr)

Converts a number to the default string representation.

Properties

isFalse
bool isFalse [@property getter]

Returns true if this number is a false value. Finite numbers with zero coefficient are false. Infinity is true and NaN is false.

Static functions

one
D one(bool sign)

Returns 1.

Structs

Decimal
struct Decimal(immutable Context _context = DefaultContext)

A floating-point decimal number.

Variables

isConvertible
enum bool isConvertible(T);

Returns true if the parameter is convertible to a decimal number.

isDecimal
enum bool isDecimal(D);

Returns true if the parameter is a decimal number.

isInteger
enum bool isInteger(T);
Undocumented in source.

Meta

Authors

Paul D. Anderson

Standards

Conforms to the 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>