addaptic

Reference Comparison

lz_compare

Whether the left number is less than, equal to or greater than the right.

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

Compares values, not spellings: hexadecimal 10 equals 16, and 0.1 equals 0.10. A number in another base is compared exactly. Either side flagged infinite or not-a-number answers kUnordered.

Examples

CallAnswer
lz_compare( 1, 2 )kLessThan
lz_compare( 0x10, 16 )kEqualTo
lz_compare( 0.1, 0.10 )kEqualTo
lz_compare( 3, −3 )kGreaterThan

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

Returns

A code, not a number: kLessThan (-1), kEqualTo (0), kGreaterThan (1), kUnordered (2).

See also

  • lz_max Which of two numbers is the larger.
  • lz_min Which of two numbers is the smaller.
  • lz_same_quantum Whether two numbers have the same number of places after the point.