Decimal.opCmp

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].

Further, in D, the NaN values of floating point types always return false in any comparison. But, this makes sorting an array with NaN values impossible.

So, -INF is less than all numbers, -NAN is greater than -INF but less than all other numbers, NAN is greater than -NAN but less than all other numbers and inf is greater than all numbers. -NAN and NAN are equal to themselves.

Signaling NAN is an invalid operation, and will trigger the appropriate hook method and always yield -1.

struct Decimal(Hook = Abort)
int
opCmp
(
T
)
(
const T d
)

Meta