Node:Assigning Floats, Next:Simultaneous Float Init & Assign, Previous:Initializing Floats, Up:Floating-point Functions
These functions assign new values to already initialized floats (see Initializing Floats).
void mpf_set (mpf_t rop, mpf_t op) | Function |
void mpf_set_ui (mpf_t rop, unsigned long int op) | Function |
void mpf_set_si (mpf_t rop, signed long int op) | Function |
void mpf_set_d (mpf_t rop, double op) | Function |
void mpf_set_z (mpf_t rop, mpz_t op) | Function |
void mpf_set_q (mpf_t rop, mpq_t op) | Function |
Set the value of rop from op. |
int mpf_set_str (mpf_t rop, char *str, int base) | Function |
Set the value of rop from the string in str. The string is of the
form M@N or, if the base is 10 or less, alternatively MeN .
M is the mantissa and N is the exponent. The mantissa is always
in the specified base. The exponent is either in the specified base or, if
base is negative, in decimal. The decimal point expected is taken from
the current locale, on systems providing localeconv .
The argument base may be in the ranges 2 to 36, or -36 to -2. Negative values are used to specify that the exponent is in decimal. Unlike the corresponding White space is allowed in the string, and is simply ignored. [This is not
really true; white-space is ignored in the beginning of the string and within
the mantissa, but not in other places, such as after a minus sign or in the
exponent. We are considering changing the definition of this function, making
it fail when there is any white-space in the input, since that makes a lot of
sense. Please tell us your opinion about this change. Do you really want it
to accept This function returns 0 if the entire string is a valid number in base base. Otherwise it returns -1. |
void mpf_swap (mpf_t rop1, mpf_t rop2) | Function |
Swap rop1 and rop2 efficiently. Both the values and the precisions of the two variables are swapped. |