sameQuantum

Compares the exponents of two _decimal values

@IEEECompliant("sameQuantum", 26)
bool
sameQuantum
(
D1
D2
)
(
auto const ref D1 x
,
auto const ref D2 y
)
if (
isDecimal!(D1, D2)
)

Parameters

x D1

a _decimal value

y D2

a _decimal value

Return Value

Type: bool

true if the internal representation of x and y use the same exponent, false otherwise Notes: Returns also true if both operands are NaN or both operands are infinite.

Examples

assert(sameQuantum(decimal32.infinity, -decimal64.infinity));

auto x = decimal32("123456e+23");
auto y = decimal64("911911e+23");
assert(sameQuantum(x, y));

Meta