Hacker News new | ask | show | jobs
by simias 1423 days ago
What's the trick to implement a zoom like this in software? I remember many years ago implementing a trivial program to display the mandelbrot fractal, but as you zoomed in you quickly ran out of precision even if you used 64bit double floats.

Is it just using "bignums" behind the scenes or is there a trick to "reset" the exponent due to the fractal nature of the display? I always wondered if, thanks to the self-similar nature of fractals, one could convert a set of coordinates to another at a different scale and yield the same results.

My intuition tells me that it wouldn't work for all fractals though, and probably not for Mandelbrot because while it's self-similar it never seems to look exactly the same at different scales.

3 comments

I'm a noob in this kind of stuff but maybe they're using fixed-point math and dynamically redefining the scaling to always have enough precision? But then if you do use fixed point you could as well use integer big numbers. Though I imagine that using any form of big numbers, int or float, is going to hurt the performance more and more as you zoom further. You may also be able to use the rule that you can multiply or divide both sides of an equation by the same number and it will remain valid.
I’d guess you need some kind of floating point bignum to do this. You can cache/memoize repeated Evals of the same point. But I think it would have to be the same point to some pretty tight tolerance (determined by screen resolution at the time). Regardless this video clearly had a lot of compute put into it.
I ran into the same problem, gave up on it. There must be some trick to it.