Next: , Previous: , Up: Rational Interval Functions   [Index]


5.2 Assignment Functions

These functions and macros assign new values to already initialised rational intervals.

Inline Function: void mpri_set (mpri_t rop, const mpri_t op)

Assign rop from op.

Macro: void MPRI_SET_ZERO (mpri_t op)
Macro: void MPRI_SET_NAN (mpri_t op)

Set the value of op to the singleton intervals [0/1,0/1] (zero) and [0/0,0/0] (NaN), respectively.

Macro: void MPRI_SET_Q (mpri_t rop, const mpq_t op)

Set the value of rop to the singleton interval [op,op].

Macro: void mpri_set_qi_z (mpri_t rop, const mpz_t op1, const mpz_t op2, const mpz_t op3, mpri_prec_t prec, mpri_srnd_t srnd)
Inline Function: void mpri_set_qi_q (mpri_t rop, const mpq_t op1, const mpq_t op2, const mpq_t op3, mpri_prec_t prec, mpri_srnd_t srnd)

Set the value of rop to the best rational interval approximation of the quadratic irrational number (op1+sqrt(op2))/op3 with a guaranteed precision of at least prec bits and with respect to the surrounding srnd. The result remains undefined if the radicand op2 is negative or if the divisor op3 is zero. While the macro mpri_set_qi_z is its natural high-level wrapper, the inline function mpri_set_qi_q belongs to one of the efficient wrappers implemented around the low-level function mpri_set_qi_z_ASGMT.

Inline Function: void mpri_set_q (mpri_t rop, const mpq_t op, mpri_prec_t prec, mpri_srnd_t srnd)
Inline Function: void mpri_set_d (mpri_t rop, double op, mpri_prec_t prec, mpri_srnd_t srnd)

Set the value of rop to the best rational interval approximation of the number op (respectively, a rational number and a double) with a guaranteed precision of at least prec bits and with respect to the surrounding srnd. Both are inline wrappers efficiently built around the low-level function mpri_set_qi_z_ASGMT; a rational being a degenerate quadratic irrational, a double an approximative rational representation of a real number.

Inline Function: void mpri_set_sqrt_q (mpri_t rop, const mpq_t op, mpri_prec_t prec, mpri_srnd_t srnd)

Set the value of rop to the best rational interval approximation of the square root of op, sqrt(op), with a guaranteed precision of at least prec bits and with respect to the surrounding srnd. The result is undefined if the radicand op is negative. It is an inline function that efficiently wraps around the low-level function mpri_set_qi_z_ASGMT.

Inline Function: void mpri_set_rsqrt_q (mpri_t rop, const mpq_t op, mpri_prec_t prec, mpri_srnd_t srnd)

Set the value of rop to the best rational interval approximation of the reciprocal square root of op, literally sqrt(op)/op, with a guaranteed precision of at least prec bits and with respect to the surrounding srnd. The result stays undefined if the operand op is either negative or zero. This inline function is an efficient wrapper built around the low-level function mpri_set_qi_z_ASGMT.

Inline Function: void mpri_swap (mpri_t rop1, mpri_t rop2)

Swap the values rop1 and rop2 efficiently.


Next: , Previous: , Up: Rational Interval Functions   [Index]