# Thread: Wanted: 8086 mandelbrot generator?

1. Originally Posted by hjalfi
I turned the BBC Micro version into a decent app (with a UI, pan-and-zoom, and Julia set support), and did the writeup, and worked through the maths --- which is dead simple, but unobvious.
Awesome stuff!

Originally Posted by hjalfi
(It does occur to me to wonder how whether 26-bit multiplication would be feasible using a 16kB quarter-square lookup table and Karatsuba long multiplication... would be nothing like this fast, of course.)
I was thinking about that as well. One Karatsuba long multiplication would be 3 short multiplications or 6 lookups in the quarter-square table, for a total of 18 lookups per iteration. On the other hand, with a table of shifted squares that has 4 byte entries instead of 2 byte entries (so losing another low bit from each entry - 24-bit precision on the BBC or 28-bit on the 8088) a double-precision squaring can be done with four single-precision squarings ((x0 + 10*x1)^2 == x0^2 + 10*((x0+x1)^2 - (x0-x1)^2)/2 + 100*x1^2) - three if we ignore the "100*x1^2" part. Then using the same technique as before, a double-precision Mandelbrot iteration would be 9 single-precision squarings (compared to 3 for a single-precision iteration) which is half as many lookups as the Karatsuba method. The tricky part is going to be adding everything together and making sure the all the carries are correct (especially if the fixed-point shift is baked into the table of squares).
Last edited by reenigne; May 27th, 2018 at 10:07 AM.

2. Senior Member
Join Date
Feb 2017
Location
Zürich, Switzerland
Posts
121
I actually managed to squeeze in another couple of bits of fractional precision --- one came from using a 32kB table in 0x4000 to 0xc000 and slightly more creative numeric fixup code; and the other by stealing a bit from the integer part of the fixed point. This limited the numeric range from +16..-16, and required me to clamp overflow values in the square table to MAXINT to avoid nasty overflow artifacts, so the resulting renderings probably aren't entirely right but I can't see any difference. (Details in the writeup.)

You can zoom all the way down to 0.25, now --- that's far enough that I might actually need to bump the iterations count!
Last edited by hjalfi; May 27th, 2018 at 06:26 AM.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•