What's the difference between?

Karl Hasselström kha at treskal.com
Sat Dec 4 13:13:29 CET 2004

On 2004-12-04 10:09:06 +0900, nimzeros at naver.com wrote:

> What's the difference between
> mpz_set_str(p,"12423141325145251512521512343434343434",10)

This is the correct way. You construct a string with the digits 1, 2,
4, 2 etc, and mpz_set_str converts it to a large integer of type

> and mpz_set_str(p,1242314132514525151252151234343434343434,10) ?

This is wrong. For the second argument, you try to construct a native
C integer with the value 1242314132514525151252151234343434343434, but
C integers can't be that big, so the compiler will complain.

> If I use
> mpz_set_str(p,"1242314132514525151252151234343434343434",10), is
> p=12423141325145251512521512343434343434?

Yes. p will be of type mpz_t, and its value is

Karl Hasselström, kha at treskal.com

More information about the gmp-discuss mailing list