manpagez: man pages & more
info mpfr
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.5 Basic Arithmetic Functions

Function: int mpfr_add (mpfr_t rop, mpfr_t op1, mpfr_t op2, mp_rnd_t rnd)
Function: int mpfr_add_ui (mpfr_t rop, mpfr_t op1, unsigned long int op2, mp_rnd_t rnd)
Function: int mpfr_add_si (mpfr_t rop, mpfr_t op1, long int op2, mp_rnd_t rnd)
Function: int mpfr_add_z (mpfr_t rop, mpfr_t op1, mpz_t op2, mp_rnd_t rnd)
Function: int mpfr_add_q (mpfr_t rop, mpfr_t op1, mpq_t op2, mp_rnd_t rnd)

Set rop to op1 + op2 rounded in the direction rnd. For types having no signed zero, it is considered unsigned (i.e. (+0) + 0 = (+0) and (-0) + 0 = (-0)).

Function: int mpfr_sub (mpfr_t rop, mpfr_t op1, mpfr_t op2, mp_rnd_t rnd)
Function: int mpfr_ui_sub (mpfr_t rop, unsigned long int op1, mpfr_t op2, mp_rnd_t rnd)
Function: int mpfr_sub_ui (mpfr_t rop, mpfr_t op1, unsigned long int op2, mp_rnd_t rnd)
Function: int mpfr_si_sub (mpfr_t rop, long int op1, mpfr_t op2, mp_rnd_t rnd)
Function: int mpfr_sub_si (mpfr_t rop, mpfr_t op1, long int op2, mp_rnd_t rnd)
Function: int mpfr_sub_z (mpfr_t rop, mpfr_t op1, mpz_t op2, mp_rnd_t rnd)
Function: int mpfr_sub_q (mpfr_t rop, mpfr_t op1, mpq_t op2, mp_rnd_t rnd)

Set rop to op1 - op2 rounded in the direction rnd. For types having no signed zero, it is considered unsigned (i.e. (+0) - 0 = (+0), (-0) - 0 = (-0), 0 - (+0) = (-0) and 0 - (-0) = (+0)).

Function: int mpfr_mul (mpfr_t rop, mpfr_t op1, mpfr_t op2, mp_rnd_t rnd)
Function: int mpfr_mul_ui (mpfr_t rop, mpfr_t op1, unsigned long int op2, mp_rnd_t rnd)
Function: int mpfr_mul_si (mpfr_t rop, mpfr_t op1, long int op2, mp_rnd_t rnd)
Function: int mpfr_mul_z (mpfr_t rop, mpfr_t op1, mpz_t op2, mp_rnd_t rnd)
Function: int mpfr_mul_q (mpfr_t rop, mpfr_t op1, mpq_t op2, mp_rnd_t rnd)

Set rop to op1 times op2 rounded in the direction rnd. When a result is zero, its sign is the product of the signs of the operands (for types having no signed zero, it is considered positive).

Function: int mpfr_sqr (mpfr_t rop, mpfr_t op, mp_rnd_t rnd)

Set rop to the square of op rounded in the direction rnd.

Function: int mpfr_div (mpfr_t rop, mpfr_t op1, mpfr_t op2, mp_rnd_t rnd)
Function: int mpfr_ui_div (mpfr_t rop, unsigned long int op1, mpfr_t op2, mp_rnd_t rnd)
Function: int mpfr_div_ui (mpfr_t rop, mpfr_t op1, unsigned long int op2, mp_rnd_t rnd)
Function: int mpfr_si_div (mpfr_t rop, long int op1, mpfr_t op2, mp_rnd_t rnd)
Function: int mpfr_div_si (mpfr_t rop, mpfr_t op1, long int op2, mp_rnd_t rnd)
Function: int mpfr_div_z (mpfr_t rop, mpfr_t op1, mpz_t op2, mp_rnd_t rnd)
Function: int mpfr_div_q (mpfr_t rop, mpfr_t op1, mpq_t op2, mp_rnd_t rnd)

Set rop to op1/op2 rounded in the direction rnd. When a result is zero, its sign is the product of the signs of the operands (for types having no signed zero, it is considered positive).

Function: int mpfr_sqrt (mpfr_t rop, mpfr_t op, mp_rnd_t rnd)
Function: int mpfr_sqrt_ui (mpfr_t rop, unsigned long int op, mp_rnd_t rnd)

Set rop to the square root of op rounded in the direction rnd. Return -0 if op is -0 (to be consistent with the IEEE 754-1985 standard). Set rop to NaN if op is negative.

Function: int mpfr_cbrt (mpfr_t rop, mpfr_t op, mp_rnd_t rnd)
Function: int mpfr_root (mpfr_t rop, mpfr_t op, unsigned long int k, mp_rnd_t rnd)

Set rop to the cubic root (resp. the kth root) of op rounded in the direction rnd. An odd (resp. even) root of a negative number (including -Inf) returns a negative number (resp. NaN). The kth root of -0 is defined to be -0, whatever the parity of k.

Function: int mpfr_pow (mpfr_t rop, mpfr_t op1, mpfr_t op2, mp_rnd_t rnd)
Function: int mpfr_pow_ui (mpfr_t rop, mpfr_t op1, unsigned long int op2, mp_rnd_t rnd)
Function: int mpfr_pow_si (mpfr_t rop, mpfr_t op1, long int op2, mp_rnd_t rnd)
Function: int mpfr_pow_z (mpfr_t rop, mpfr_t op1, mpz_t op2, mp_rnd_t rnd)
Function: int mpfr_ui_pow_ui (mpfr_t rop, unsigned long int op1, unsigned long int op2, mp_rnd_t rnd)
Function: int mpfr_ui_pow (mpfr_t rop, unsigned long int op1, mpfr_t op2, mp_rnd_t rnd)

Set rop to op1 raised to op2, rounded in the direction rnd. Special values are currently handled as described in the ISO C99 standard for the pow function (note this may change in future versions):

  • pow(±0, y) returns plus or minus infinity for y a negative odd integer.
  • pow(±0, y) returns plus infinity for y negative and not an odd integer.
  • pow(±0, y) returns plus or minus zero for y a positive odd integer.
  • pow(±0, y) returns plus zero for y positive and not an odd integer.
  • pow(-1, ±Inf) returns 1.
  • pow(+1, y) returns 1 for any y, even a NaN.
  • pow(x, ±0) returns 1 for any x, even a NaN.
  • pow(x, y) returns NaN for finite negative x and finite non-integer y.
  • pow(x, -Inf) returns plus infinity for 0 < abs(x) < 1, and plus zero for abs(x) > 1.
  • pow(x, +Inf) returns plus zero for 0 < abs(x) < 1, and plus infinity for abs(x) > 1.
  • pow(-Inf, y) returns minus zero for y a negative odd integer.
  • pow(-Inf, y) returns plus zero for y negative and not an odd integer.
  • pow(-Inf, y) returns minus infinity for y a positive odd integer.
  • pow(-Inf, y) returns plus infinity for y positive and not an odd integer.
  • pow(+Inf, y) returns plus zero for y negative, and plus infinity for y positive.
Function: int mpfr_neg (mpfr_t rop, mpfr_t op, mp_rnd_t rnd)

Set rop to -op rounded in the direction rnd. Just changes the sign if rop and op are the same variable.

Function: int mpfr_abs (mpfr_t rop, mpfr_t op, mp_rnd_t rnd)

Set rop to the absolute value of op, rounded in the direction rnd. Just changes the sign if rop and op are the same variable.

Function: int mpfr_dim (mpfr_t rop, mpfr_t op1, mpfr_t op2, mp_rnd_t rnd)

Set rop to the positive difference of op1 and op2, i.e., op1 - op2 rounded in the direction rnd if op1 > op2, and +0 otherwise. Returns NaN when op1 or op2 is NaN.

Function: int mpfr_mul_2ui (mpfr_t rop, mpfr_t op1, unsigned long int op2, mp_rnd_t rnd)
Function: int mpfr_mul_2si (mpfr_t rop, mpfr_t op1, long int op2, mp_rnd_t rnd)

Set rop to op1 times 2 raised to op2 rounded in the direction rnd. Just increases the exponent by op2 when rop and op1 are identical.

Function: int mpfr_div_2ui (mpfr_t rop, mpfr_t op1, unsigned long int op2, mp_rnd_t rnd)
Function: int mpfr_div_2si (mpfr_t rop, mpfr_t op1, long int op2, mp_rnd_t rnd)

Set rop to op1 divided by 2 raised to op2 rounded in the direction rnd. Just decreases the exponent by op2 when rop and op1 are identical.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.