numericCompare

fun A_Number.numericCompare(another: A_Number): AbstractNumberDescriptor.Order

Answer an ordering between the receiver and the argument. This compares the underlying real numeric values of the two A_Numbers, which does not necessarily agree with the equals semantics. In particular, under numerical ordering, 5 = 5.0 = 5.0f, and 0.0/0.0 is incomparable to every number, even itself. Under ordinary equality (the equals method), an integer never equals a float, and neither ever equals a double. However, 0.0/0.0 is equal to 0.0/0.0, since they have the same kind (double) and the same bit pattern. Note that hash agrees with general equality, not the numeric ordering.

The numeric order is not directly exposed to Avail, but it can be reconstructed by computing the P_LessOrEqual predicate on two values and also on the two values interchanged. If one but not the other is true, the order is either Order.LESS or Order.MORE. If both are true, the values are Order.EQUAL, and if neither is true then the values are Order.INCOMPARABLE, which is only the case if one or both values are float or double not-a-numbers (easily produced via 0.0/0.0).

Return

The numeric Order between the receiver and the argument.

Parameters

another

The value to numerically compare the receiver to.