isCanonical

Determines if x is canonical. This operation is silent, no error flags are set and no exceptions are thrown.

@IEEECompliant("isCanonical", 25)
bool
isCanonical
(
D
)
(
auto const ref D x
)

Parameters

x D

a _decimal value

Return Value

Type: bool

true if x is canonical, false otherwise Notes: A _decimal value is considered canonical:<br/> - if the value is NaN, the payload must be less than 10 precision - 1;<br/> - if the value is infinity, no trailing bits are accepted;<br/> - if the value is finite, the coefficient must be less than 10 precision.

Examples

assert(isCanonical(decimal32.max));
assert(isCanonical(decimal64.max));
assert(!isCanonical(decimal32("nan(0x3fffff)")));

Meta