Go to the first, previous, next, last section, table of contents.


Assignment Functions

These functions assign new values to already initialized floats (see section Initialization and Assignment Functions).

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)
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.


Go to the first, previous, next, last section, table of contents.