The OpenD Programming Language

WithNaN.hookOpCmp

If lhs == WithNaN.defaultValue!Lhs, returns double.init. Otherwise, has the same semantics as the default comparison.

struct WithNaN
static
double
hookOpCmp
(
Lhs
Rhs
)
(
Lhs lhs
,
Rhs rhs
)

Parameters

lhs Lhs

The left-hand side of the comparison (Lhs is the first argument to Checked)

rhs Rhs

The right-hand side of the comparison

Return Value

Type: double

double.init if lhs == WitnNaN.defaultValue!Lhs, -1.0 if lhs < rhs, 0.0 if lhs == rhs, 1.0 if lhs > rhs.

Examples

Checked!(int, WithNaN) x;
assert(!(x < 0) && !(x > 0) && !(x == 0));
x = 1;
assert(x > 0 && !(x < 0) && !(x == 0));

Meta