[Haskell-cafe] Matters of precision

Andrew Coppin andrewcoppin at btinternet.com
Thu Aug 9 13:47:04 EDT 2007

Hi folks.

I'm trying to write a Mandelbrot generator, and I've having a few 
problems with precision.

First of all, currently I'm just using Double to represent coordinates. 
Can anybody tell me what the smallest value you can represent with one 
is? (Not including denormals.)

(I've built a function that checks for cycles in the orbit - by looking 
for previous points that are sufficiently "near" to the current one. But 
I want to know how much precision a Double gives me so I can figure out 
how near is "near".)

Next up, at some point I'm going to need more precision than a Double 
can give me. (But, obviously, I still want the thing to go as fast as 
humanly possible.) In particular, I do NOT want to go into "infinite" 
precision. (E.g., exact arithmetic with arbitrary fractions.) I want to 
be able to make the precision arbitrarily high, but still finite and 
fixed. (The idea being that the further you zoom in, the more the 
computer turns up the precision.) Is there anything useful for this in 
the standard libraries? Or will I have to write something?

More information about the Haskell-Cafe mailing list