GNU Info

Info Node: (gmp.info)Assigning Integers

(gmp.info)Assigning Integers


Next: Simultaneous Integer Init & Assign Prev: Initializing Integers Up: Integer Functions
Enter node , (file) or (file)node

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

   These functions assign new values to already initialized integers
(Note: Initializing Integers).

 - Function: void mpz_set (mpz_t ROP, mpz_t OP)
 - Function: void mpz_set_ui (mpz_t ROP, unsigned long int OP)
 - Function: void mpz_set_si (mpz_t ROP, signed long int OP)
 - Function: void mpz_set_d (mpz_t ROP, double OP)
 - Function: void mpz_set_q (mpz_t ROP, mpq_t OP)
 - Function: void mpz_set_f (mpz_t ROP, mpf_t OP)
     Set the value of ROP from OP.

     `mpz_set_d', `mpz_set_q' and `mpz_set_f' truncate OP to make it an
     integer.

 - Function: int mpz_set_str (mpz_t ROP, char *STR, int BASE)
     Set the value of ROP from STR, a null-terminated C string in base
     BASE.  White space is allowed in the string, and is simply
     ignored.  The base may vary from 2 to 36.  If BASE is 0, the
     actual base is determined from the leading characters: if the
     first two characters are "0x" or "0X", hexadecimal is assumed,
     otherwise if the first character is "0", octal is assumed,
     otherwise decimal is assumed.

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

     [It turns out that it is not entirely true that this function
     ignores white-space.  It does ignore it between digits, but not
     after a minus sign or within or after "0x".  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.  Send your opinion of this change to <bug-gmp@gnu.org>.  Do
     you really want it to accept "3 14" as meaning 314 as it does now?]

 - Function: void mpz_swap (mpz_t ROP1, mpz_t ROP2)
     Swap the values ROP1 and ROP2 efficiently.


automatically generated by info2www version 1.2.2.9