www.delorie.com/gnu/docs/gmp/gmp_37.html   search  
 
Buy GNU books!


GNU MP 4.1.2

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.10 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.

Note that mpz_cmp_ui and mpz_cmp_si are macros and will evaluate their arguments more than once.

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).

Note that mpz_cmpabs_si is a macro and will evaluate its arguments more than once.

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.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003