addaptic

Reference Comparison

lz_same_quantum

Whether two numbers have the same number of places after the point.

long lz_same_quantum( CLZNumber* leftOperand, CLZNumber* rightOperand );

It reads no digits, only how many places each number has after its point, so a place is counted in each number's own base: hexadecimal 15.6 and decimal 0.5 have one each. A flagged number answers kUnordered.

Examples

CallAnswer
lz_same_quantum( 1.23, 4.56 )kEqual
lz_same_quantum( 1.2, 1.20 )kNotEqual
lz_same_quantum( 0x15.6, 0.5 )kEqual

Each answer is what Addaptic printed for the call, at 36 places unless a setting is shown.

Returns

A code, not a number: kNotEqual (-1), kEqual (0), kUnordered (2).

See also

  • lz_quantize The left number rounded to as many places as the right number has.
  • lz_compare Whether the left number is less than, equal to or greater than the right.