- Function:
`int`

**mpq_cmp**`(const mpq_t`

¶`op1`, const mpq_t`op2`) - Function:
`int`

**mpq_cmp_z**`(const mpq_t`

¶`op1`, const mpz_t`op2`) Compare

`op1`and`op2`. Return a positive value if, zero if`op1`>`op2`, and a negative value if`op1`=`op2`.`op1`<`op2`To determine if two rationals are equal,

`mpq_equal`

is faster than`mpq_cmp`

.

- Macro:
`int`

**mpq_cmp_ui**`(const mpq_t`

¶`op1`, unsigned long int`num2`, unsigned long int`den2`) - Macro:
`int`

**mpq_cmp_si**`(const mpq_t`

¶`op1`, long int`num2`, unsigned long int`den2`) Compare

`op1`and`num2`/`den2`. Return a positive value if, zero if`op1`>`num2`/`den2`, and a negative value if`op1`=`num2`/`den2`.`op1`<`num2`/`den2``num2`and`den2`are allowed to have common factors.These functions are implemented as macros and evaluate their arguments multiple times.

- Macro:
`int`

**mpq_sgn**`(const mpq_t`

¶`op`) -
Return

*+1*if, 0 if`op`> 0, and`op`= 0*-1*if.`op`< 0This function is actually implemented as a macro. It evaluates its argument multiple times.

- Function:
`int`

**mpq_equal**`(const mpq_t`

¶`op1`, const mpq_t`op2`) Return non-zero if

`op1`and`op2`are equal, zero if they are non-equal. Although`mpq_cmp`

can be used for the same purpose, this function is much faster.