Decimal

Behavior is defined by Hook. Number of significant digits is limited by Hook.precision.

Spec: http://speleotrove.com/decimal/decarith.html

Constructors

this
this(T num)

Note: Float construction less accurate that string, Use string construction if possible

this
this(S str)

implements spec to-number

Members

Aliases

hook
alias hook = Hook
Undocumented in source.
toString
alias toString = toDecimalString

Functions

opBinary
auto opBinary(T rhs)

The result has the hook of the left hand side. Invalid operations call onInvalidOperation on the hook on the result and set the result's flag to true. Does not effect the left hand side of the operation.

opCmp
int opCmp(T d)

The spec says that comparing NANs should yield NAN. Unfortunately this isn't possible in D, as the return value of opCmp must be [-1, 1].

opEquals
bool opEquals(T d)
round
auto round()
Undocumented in source. Be warned that the author may not have intended to support it.
toDecimalString
auto toDecimalString()
void toDecimalString(Writer w)

Decimal strings

Manifest constants

hasClampedMethod
enum hasClampedMethod;
Undocumented in source.
hasDivisionByZeroMethod
enum hasDivisionByZeroMethod;
Undocumented in source.
hasInexactMethod
enum hasInexactMethod;
Undocumented in source.
hasInvalidOperationMethod
enum hasInvalidOperationMethod;
Undocumented in source.
hasOverflowMethod
enum hasOverflowMethod;
Undocumented in source.
hasRoundedMethod
enum hasRoundedMethod;
Undocumented in source.
hasSubnormalMethod
enum hasSubnormalMethod;
Undocumented in source.
hasUnderflowMethod
enum hasUnderflowMethod;
Undocumented in source.
useBigInt
enum useBigInt;
Undocumented in source.

Variables

clamped
bool clamped;

Public flags

coefficient
BigInt coefficient;
Undocumented in source.
coefficient
ulong coefficient;
Undocumented in source.
divisionByZero
bool divisionByZero;

Public flags

exponent
long exponent;
Undocumented in source.
hook
Hook hook;

hook is a member variable if it has state, or an alias for Hook otherwise.

inexact
bool inexact;

Public flags

inf
bool inf;
Undocumented in source.
invalidOperation
bool invalidOperation;
overflow
bool overflow;

Public flags

qNaN
bool qNaN;
Undocumented in source.
rounded
bool rounded;

Public flags

sNaN
bool sNaN;
Undocumented in source.
sign
bool sign;
Undocumented in source.
subnormal
bool subnormal;
underflow
bool underflow;

Public flags

Meta