Why do the work all over again when there is Gmp.mpq? :-)
Pike v7.4 release 13 running Hilfe v3.5 (Incremental Pike Frontend)
Gmp.mpq(3580,100);
(1) Result: 179/5
(float)_;
(2) Result: 35.799999
/ Johan Sundström (a hugging punishment!)
Previous text:
2003-02-25 10:04: Subject: Re: Do we have a floatingpoint bug?
given the bignum library which supports unlimited integers, how about a "float" type that supports precise calculations?
it could be as simple as taking a bignum and adding an exponent to it.
ie: 3.141593 store as 3141593 with exponent 6.
the necessary conversions to allow calculations could then be handled in pike internally instead of burdening the user if he/she needs to avoid the usual floating point problems.
greetings, martin.
/ Brevbäraren