Go forward to Simultaneous Integer Init & Assign.
Go backward to Initializing Integers.
Go up to Integer Functions.
Assignment Functions
--------------------
These functions assign new values to already initialized integers
(see 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.
- Function: int mpz_set_str (mpz_t ROP, char *STR, int BASE)
Set the value of ROP from STR, a '\0'-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 up to the '\0' is a
valid number in base BASE. Otherwise it returns -1.