DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK

# (gmp.info.gz) Integer Comparisons

Info Catalog (gmp.info.gz) Number Theoretic Functions (gmp.info.gz) Integer Functions (gmp.info.gz) Integer Logic and Bit Fiddling
```
Comparison Functions
====================

- Function: int mpz_cmp (mpz_t OP1, mpz_t OP2)
- Function: int mpz_cmp_d (mpz_t OP1, double OP2)
- Macro: int mpz_cmp_si (mpz_t OP1, signed long int OP2)
- Macro: int mpz_cmp_ui (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 (mpz_t OP1, mpz_t OP2)
- Function: int mpz_cmpabs_d (mpz_t OP1, double OP2)
- Function: int mpz_cmpabs_ui (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 (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.

```
Info Catalog (gmp.info.gz) Number Theoretic Functions (gmp.info.gz) Integer Functions (gmp.info.gz) Integer Logic and Bit Fiddling
automatically generated byinfo2html