GNU Info

Info Node: (gmp.info)Assigning Floats

(gmp.info)Assigning Floats


Next: Simultaneous Float Init & Assign Prev: Initializing Floats Up: Floating-point Functions
Enter node , (file) or (file)node

Assignment Functions
====================

   These functions assign new values to already initialized floats
(Note: 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 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 `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 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 "3 14" as meaning 314 as it does now?]

     This function returns 0 if the entire string is a valid number in
     base BASE.  Otherwise it returns -1.

 - Function: void mpf_swap (mpf_t ROP1, mpf_t ROP2)
     Swap ROP1 and ROP2 efficiently.  Both the values and the
     precisions of the two variables are swapped.


automatically generated by info2www version 1.2.2.9