Next: Special Functions, Previous: Basic Arithmetic Functions, Up: MPFR Interface [Index]
Compare op1 and op2. Return a positive value if op1 > op2, zero if op1 = op2, and a negative value if op1 < op2. Both op1 and op2 are considered to their full own precision, which may differ. If one of the operands is NaN, set the erange flag and return zero.
Note: These functions may be useful to distinguish the three possible cases.
If you need to distinguish two cases only, it is recommended to use the
predicate functions (e.g., mpfr_equal_p
for the equality) described
below; they behave like the IEEE 754 comparisons, in particular when one
or both arguments are NaN. But only floating-point numbers can be compared
(you may need to do a conversion first).
Compare op1 and op2 multiplied by two to the power e. Similar as above.
Compare |op1| and |op2|. Return a positive value if |op1| > |op2|, zero if |op1| = |op2|, and a negative value if |op1| < |op2|. If one of the operands is NaN, set the erange flag and return zero.
Return non-zero if op is respectively NaN, an infinity, an ordinary number (i.e., neither NaN nor an infinity), zero, or a regular number (i.e., neither NaN, nor an infinity nor zero). Return zero otherwise.
Return a positive value if op > 0, zero if op = 0,
and a negative value if op < 0.
If the operand is NaN, set the erange flag and return zero.
This is equivalent to mpfr_cmp_ui (op, 0)
, but more efficient.
Return non-zero if op1 > op2, op1 >= op2, op1 < op2, op1 <= op2, op1 = op2 respectively, and zero otherwise. Those functions return zero whenever op1 and/or op2 is NaN.
Return non-zero if op1 < op2 or op1 > op2 (i.e., neither op1, nor op2 is NaN, and op1 <> op2), zero otherwise (i.e., op1 and/or op2 is NaN, or op1 = op2).
Return non-zero if op1 or op2 is a NaN (i.e., they cannot be compared), zero otherwise.
Next: Special Functions, Previous: Basic Arithmetic Functions, Up: MPFR Interface [Index]