and i just noticed this: Gmp.mpf(Gmp.mpq(31415926,10000000)); also works.
Unfortunately it does not for bigger numbers:
Gmp.mpq(314159265358979323846264338327950288419716939937510582,
100000000000000000000000000000000000000000000000000000); Bad arg 2 for Gmp.mpq(), expected integer.
/ Johan Sundström (a hugging punishment!)
Previous text:
2003-02-25 11:46: Subject: Re: Do we have a floatingpoint bug?
On Tue, Feb 25, 2003 at 11:30:01AM +0100, Mirar @ Pike developers forum wrote:
You don't happen to have a Pi-generating algorithm around? :)
there is a website where you can download a few megabytes worth of digits. though atm i am more interrested in an algorithm to generate prime numbers actually... (but thats another topic)
Gmp.mpf("3.1415926",32*256,10);
ahh, a string. and i just noticed this: Gmp.mpf(Gmp.mpq(31415926,10000000)); also works.
thanks.
sprintf %f and cast to string is broken for mpf, so I guess you'll have to do something else (cast to float?).
wait for the bug to get fixed ;-) considering that mpf is just a subset of mpq the latter will do fine
/ Brevbäraren