Next: , Previous: , Up: Floating-point Functions   [Index]


7.5 Arithmetic Functions

Function: void mpf_add (mpf_t rop, const mpf_t op1, const mpf_t op2)
Function: void mpf_add_ui (mpf_t rop, const mpf_t op1, unsigned long int op2)

Set rop to op1 + op2.

Function: void mpf_sub (mpf_t rop, const mpf_t op1, const mpf_t op2)
Function: void mpf_ui_sub (mpf_t rop, unsigned long int op1, const mpf_t op2)
Function: void mpf_sub_ui (mpf_t rop, const mpf_t op1, unsigned long int op2)

Set rop to op1 - op2.

Function: void mpf_mul (mpf_t rop, const mpf_t op1, const mpf_t op2)
Function: void mpf_mul_ui (mpf_t rop, const mpf_t op1, unsigned long int op2)

Set rop to op1 times op2.

Division is undefined if the divisor is zero, and passing a zero divisor to the divide functions will make these functions intentionally divide by zero. This lets the user handle arithmetic exceptions in these functions in the same manner as other arithmetic exceptions.

Function: void mpf_div (mpf_t rop, const mpf_t op1, const mpf_t op2)
Function: void mpf_ui_div (mpf_t rop, unsigned long int op1, const mpf_t op2)
Function: void mpf_div_ui (mpf_t rop, const mpf_t op1, unsigned long int op2)

Set rop to op1/op2.

Function: void mpf_sqrt (mpf_t rop, const mpf_t op)
Function: void mpf_sqrt_ui (mpf_t rop, unsigned long int op)

Set rop to the square root of op.

Function: void mpf_pow_ui (mpf_t rop, const mpf_t op1, unsigned long int op2)

Set rop to op1 raised to the power op2.

Function: void mpf_neg (mpf_t rop, const mpf_t op)

Set rop to -op.

Function: void mpf_abs (mpf_t rop, const mpf_t op)

Set rop to the absolute value of op.

Function: void mpf_mul_2exp (mpf_t rop, const mpf_t op1, mp_bitcnt_t op2)

Set rop to op1 times 2 raised to op2.

Function: void mpf_div_2exp (mpf_t rop, const mpf_t op1, mp_bitcnt_t op2)

Set rop to op1 divided by 2 raised to op2.


Next: , Previous: , Up: Floating-point Functions   [Index]