infinite (fractional) precision

Hi I was just browsing around on comp.arch a bit, and there was this discussion about various ways to represent non-integer numeric values. It seems one could easily (I'll get back to that in a moment) calculate the fractional part of numbers lazily, generating the needed precision, and nothing more. Does any such implementation exist in Haskell? I realize it's probably far from trivial, e.g. comparing two equal numbers could easily not terminate, and memory exhaustion would probably arise in many other cases. So, if such implementations exist, how does one deal with these issues? Is it indeed possible to make this useful in practice? (And if it hasn't been implemented, would anybody be interested if I gave it a try?) -kzm -- If I haven't seen further, it is by standing in the footprints of giants

On 10 Oct 2002 10:29:24 +0200 ketil@ii.uib.no (Ketil Z. Malde) wrote:
I realize it's probably far from trivial, e.g. comparing two equal numbers could easily not terminate,
you should compare into a given precision V. -- Fedeli alla linea, anche quando non c'è Quando l'imperatore è malato, quando muore,o è dubbioso, o è perplesso. Fedeli alla linea la linea non c'è. [CCCP]

Ketil Z. Malde wrote:
It seems one could easily (I'll get back to that in a moment) calculate the fractional part of numbers lazily, generating the needed precision, and nothing more. Does any such implementation exist in Haskell?
I realize it's probably far from trivial, e.g. comparing two equal numbers could easily not terminate, and memory exhaustion would probably arise in many other cases.
So, if such implementations exist, how does one deal with these issues? Is it indeed possible to make this useful in practice?
Well, I implemented such a stuff for fun. Look here: http://users.info.unicaen.fr/~karczma/arpap/lazypi.ps.gz This shows how to implement Bailey-Borwein-Plouffe formula for PI, using lazy hexadec. fractions, and converting them to decimal. This is a crazy idea, with algorithms which are partly co-recursive, and partly recursive, borrowing the carry from the non-existing yet future. It could be done in a safer way, but I repeat that I did it for sheer joy. Perhaps one day I will return to it, unless somebody does it first. Jerzy Karczmarczuk
participants (3)
-
Jerzy Karczmarczuk
-
ketil@ii.uib.no
-
Nick Name