Go forward to Simultaneous Float Init & Assign.
Go backward to Initializing Floats.
Go up to Floating-point Functions.
Assignment Functions
--------------------
These functions assign new values to already initialized floats
(see Initializing Floats.).
- Function: 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)
Set the value of ROP from OP.
- Function: int mpf_set_str (mpf_t ROP, char *STR, int BASE)
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 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 `mpz' function, the base will not be
determined from the leading characters of the string if BASE is 0.
This is so that numbers like `0.23' are not interpreted as octal.
White space is allowed in the string, and is simply ignored.
This function returns 0 if the entire string up to the '\0' is a
valid number in base BASE. Otherwise it returns -1.