A bignum issue on Math function pow()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

A bignum issue on Math function pow()

Woojin Jeon
Hello,

I'm using Pike build 8.0.1116,
and came across an error around bignum
I'm sure I compiled it with a bignum support, but I met following error:

Pike v8.0 release 1116 running Hilfe v3.5 (Incremental Pike Frontend)
> pow(5,999999);
Bad argument 1 to pow(). Exponent too large.
Unknown program: pow(Gmp.mpz(999999))
-:1: 5->pow(@0=Gmp.mpz(999999))
HilfeInput:1: HilfeInput()->___HilfeWrapper()

I'd searched and found two:

i. the example listed below, it seemed to work, but with 8.0.1116, no luck

Pike

> string res = (string)pow(5,pow(4,pow(3,2)));
> res[..19] == "62060698786608744707";
Result: 1
> res[<19..] == "92256259918212890625";
Result: 1
> sizeof(result);
Result: 183231

-> Tried this example, see
> string res = (string)pow(5,pow(4,pow(3,2)));
Bad argument 1 to pow(). Exponent too large.
Unknown program: pow(Gmp.mpz(262144))
-:1: 5->pow(@0=Gmp.mpz(262144))

ii. a similar issue reported here

https://stackoverflow.com/questions/46478975/how-can-i-implement-the-library-gmp-mpz-to-generate-big-numbers-in-pike

It would be much appreciated if someone at Dev address this issue,

Best regards,
woody