Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!brutus.cs.uiuc.edu!jarthur!rspangle From: rspangle@jarthur.Claremont.EDU (Randy Spangler) Newsgroups: comp.graphics Subject: Re: Mandelbrot algorithm summary Keywords: mandelbrot algorithm Message-ID: <4212@jarthur.Claremont.EDU> Date: 7 Feb 90 18:20:12 GMT References: <5480@vax1.tcd.ie> <536@dino.cs.iastate.edu> Organization: Harvey Mudd College, Claremont, CA 91711 Lines: 44 >In article <5480@vax1.tcd.ie> cbuckley@vax1.tcd.ie (Colm Buckley) writes: > > [using 32bit fixed point for mandelbrot computations] > >}The numbers are stored multiplied by 2**28, ... > > [addition and subtraction work ok, but muliply...] > >}poses a problem. When two numbers stored in this fashion are multiplied >}together, the result will be 2**28 times too big ( (x * 2**28) * (y * 2**28) = >}(x * y * 2**56), not (x * y * 2**28). Therefore, when multiplication is >}necessary, the multiplicand and multiplier must both be divided by (2**14). >}This is easily and quickly accomplished by right-shifting x and y by 14 bits >}(x >> 14 = x / (2**14) ). Well, those of us with 80386's can multiply two 32-bit numbers and get a 64-bit number in EDX:EAX (first 32 in EDX, next 32 in EAX) with the following code: MOV eax,number1 IMUL number2 where number1 and number2 are 32-bit memory operands. I don't know if the 68000 chips have similar instructions, but I would assume so. The next is pretty system-specific (IBM 80x87 only). I have a program I wrote in assembly to plot mandelbrot sets using the floating point chip. I optimized it so that all the calculations are done using the chip's registers - no conversion to regular memory operands. It's slower than 32-bit integer math, but more accurate than any other program I've seen for the IBM at high resolution, since the numbers never leave the 10-byte format that the 80x87 stores them in (as opposed to 8-byte long floating point type for memory operands). Since the code only applies to a small segment of the readers, I'll email copies to interested people, unless I get so many responses that I think it's worth posting. -- -------------------------------------------------------------------------- | Randy Spangler | The less things change, the | | rspangle@jarthur.claremont.edu | more they remain the same | --------------------------------------------------------------------------