Previous: , Up: Extra Number Functions   [Index]


7.2 Extra Signed Integer Functions

Macro: MPRIA_MPZ_SET_ZERO (Z)
Macro: MPRIA_MPZ_SET_POS_ONE (Z)
Macro: MPRIA_MPZ_SET_NEG_ONE (Z)

Set the value of the signed integer Z to 0, +1 and -1, respectively. These utility functions are implemented as plain macros (with self-explanatory names).

Macro: MPRIA_MPZ_IS_ZERO (Z)
Macro: MPRIA_MPZ_IS_NONZERO (Z)
Macro: MPRIA_MPZ_IS_POSITIVE (Z)
Macro: MPRIA_MPZ_IS_NEGATIVE (Z)
Macro: MPRIA_MPZ_IS_STRICTLY_POSITIVE (Z)
Macro: MPRIA_MPZ_IS_STRICTLY_NEGATIVE (Z)

Return 1 (read true) if the signed integer Z is either zero, nonzero, positive, negative, strictly positive or strictly negative, respectively, and 0 (read false) otherwise. These test functions are plain macro functions (with self-explanatory names).

Inline Function: int mpria_mpz_sgn (const mpz_t op)

Return +1 if the signed integer op is strictly positive, 0 if it is zero, or -1 if it is strictly negative.
While its counterpart mpz_sgn is implemented as a macro, this function is implemented as an inline function: it evaluates its argument only once.

Inline Function: void mpria_mpz_minabs3 (mpz_t rop, const mpz_t op1, const mpz_t op2, const mpz_t op3)

Set the value of rop to the minimum of the triplet {abs(op1),abs(op2),abs(op3)}.