[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
5.2 Assignment Functions
These functions assign new values to already initialized integers (see section Initialization Functions).
- Function: void mpz_set (mpz_t rop, const 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, const mpq_t op)
- Function: void mpz_set_f (mpz_t rop, const mpf_t op)
Set the value of rop from op.
mpz_set_d
,mpz_set_q
andmpz_set_f
truncate op to make it an integer.
- Function: int mpz_set_str (mpz_t rop, const 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 62, or if base is 0, then the leading characters are used:
0x
and0X
for hexadecimal,0b
and0B
for binary,0
for octal, or decimal otherwise.For bases up to 36, case is ignored; upper-case and lower-case letters have the same value. For bases 37 to 62, upper-case letter represent the usual 10..35 while lower-case letter represent 36..61.
This function returns 0 if the entire string is a valid number in base base. Otherwise it returns -1.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on March 31, 2014 using texi2html 5.0.