Path: utzoo!attcan!uunet!dino!ux1.cso.uiuc.edu!uwm.edu!psuvax1!psuvm!brl102 From: BRL102@psuvm.psu.edu (Ben Liblit) Newsgroups: comp.sys.apple Subject: Re: AE, Mandelbrot generator Message-ID: <90038.183056BRL102@PSUVM.BITNET> Date: 7 Feb 90 23:30:56 GMT References: <9002071850.AA29665@en.ecn.purdue.edu> Organization: Penn State University Lines: 51 Newsgroups: comp.sys.apple Subject: Re: AE, Mandelbrot generator References: <9002071850.AA29665@en.ecn.purdue.edu> Organization: Penn State University Date: Wednesday, 7 Feb 1990 18:28:42 EST From: Ben Liblit Message-ID: <90038.182842BRL102@PSUVM.BITNET> In article <9002071850.AA29665@en.ecn.purdue.edu>, eldorado@EN.ECN.PURDUE.EDU (David D Jansen) says: > >Could someone with fractal experience tell me why I get weird data. It gets >the basic shape but not quite right. >type >region = record {a rectangle on the imaginary plane} > amin : real; > bmin : real; > amax : real; > bmax : real; > end; This declaration isn't the error source, but makes me cringe. It seems that a nicer-looking declaration, that better reflects what you're representing, would be: TYPE region = RECORD min, max : imaginary END; Of course, my format is different, but that doesn't matter -- it's the idea that counts. As for the actual source of your errors, your real variables are probably being rounded off. After a few hundred iterations, that can add up to some rather large inaccuracies. There are a few things you can try: If your compiler has other, higher precision floating point types, use them. Look for something called double or extended. The tradeoff is reduction in speed. You could also junk the floating point altogether, and switch to straight integer math. It's blindingly fast, and I *think* it's supposed to be more accurate. Someone posted the core routines for Mandelbrot set iterating in C a short while back. Anyone remember where this appeared? Major tradoff of going all-integer: you have to rewrite the multiplication and division routines. Ben Liblit BRL102 @ psuvm.bitnet -- BRL102 @ psuvm.psu.edu "Fais que tes reves soient plus longs que la nuit."