Integer Comparisons (GNU MP 6.3.0)
Description: How to install and use the GNU multiple precision arithmetic library, version 6.3.0.

### 5.10 Comparison Functions ¶

Function: `int` mpz_cmp `(const mpz_t op1, const mpz_t op2)` ¶
Function: `int` mpz_cmp_d `(const mpz_t op1, double op2)` ¶
Macro: `int` mpz_cmp_si `(const mpz_t op1, signed long int op2)` ¶
Macro: `int` mpz_cmp_ui `(const mpz_t op1, unsigned long int op2)` ¶

  Compare op1 and op2. Return a positive value if op1 > op2, zero if op1 = op2, or a negative value if op1 < op2.

  `mpz_cmp_ui` and `mpz_cmp_si` are macros and will evaluate their arguments more than once. `mpz_cmp_d` can be called with an infinity, but results are undefined for a NaN.

Function: `int` mpz_cmpabs `(const mpz_t op1, const mpz_t op2)` ¶
Function: `int` mpz_cmpabs_d `(const mpz_t op1, double op2)` ¶
Function: `int` mpz_cmpabs_ui `(const mpz_t op1, unsigned long int op2)` ¶

  Compare the absolute values of op1 and op2. Return a positive value if abs(op1) > abs(op2), zero if abs(op1) = abs(op2), or a negative value if abs(op1) < abs(op2).

  `mpz_cmpabs_d` can be called with an infinity, but results are undefined for a NaN.

Macro: `int` mpz_sgn `(const mpz_t op)` ¶

  Return +1 if op > 0, 0 if op = 0, and -1 if op < 0.

  This function is actually implemented as a macro. It evaluates its argument multiple times.