Node:Float Arithmetic, Next:, Previous:Converting Floats, Up:Floating-point Functions



Arithmetic Functions

void mpf_add (mpf_t rop, mpf_t op1, mpf_t op2) Function
void mpf_add_ui (mpf_t rop, mpf_t op1, unsigned long int op2) Function
Set rop to op1 + op2.

void mpf_sub (mpf_t rop, mpf_t op1, mpf_t op2) Function
void mpf_ui_sub (mpf_t rop, unsigned long int op1, mpf_t op2) Function
void mpf_sub_ui (mpf_t rop, mpf_t op1, unsigned long int op2) Function
Set rop to op1 - op2.

void mpf_mul (mpf_t rop, mpf_t op1, mpf_t op2) Function
void mpf_mul_ui (mpf_t rop, mpf_t op1, unsigned long int op2) Function
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.

void mpf_div (mpf_t rop, mpf_t op1, mpf_t op2) Function
void mpf_ui_div (mpf_t rop, unsigned long int op1, mpf_t op2) Function
void mpf_div_ui (mpf_t rop, mpf_t op1, unsigned long int op2) Function
Set rop to op1/op2.

void mpf_sqrt (mpf_t rop, mpf_t op) Function
void mpf_sqrt_ui (mpf_t rop, unsigned long int op) Function
Set rop to the square root of op.

void mpf_pow_ui (mpf_t rop, mpf_t op1, unsigned long int op2) Function
Set rop to op1 raised to the power op2.

void mpf_neg (mpf_t rop, mpf_t op) Function
Set rop to -op.

void mpf_abs (mpf_t rop, mpf_t op) Function
Set rop to the absolute value of op.

void mpf_mul_2exp (mpf_t rop, mpf_t op1, unsigned long int op2) Function
Set rop to op1 times 2 raised to op2.

void mpf_div_2exp (mpf_t rop, mpf_t op1, unsigned long int op2) Function
Set rop to op1 divided by 2 raised to op2.