[Fractint] BUG - Float=y Calculation Error! (all MandelbrotMix images are reflections!)
Greetings, everyone I've caught Fractint red-handed getting its sums wrong! The proof is simple but irresistible. It turns out that Jim Muth's excellent image, Fractal_Medallion, is in fact a reflected image of the reflection of his window. In fact all images using MandelbrotMix4 are accidental reflections! In a nutshell, Fracint sometimes gets the imaginary sign wrong. Where you think you are getting -5 ^ x, you might actualy be getting conj(-5 ^ x). A little scary, yes? I've provided a detailed account of my investigations below: 1. Bug Description 2. Bug Demonstration 3. Bug Analysis 4. Bug Impact 5. Bug demo formula/par I hope you all find it interesting, and I look forward to feedback. Regards Jim White =================================================================== 1. Bug Description In the formula, MandelbrotMix4, the initial value of Z is set using this expression z = (-a*b*g*h)^j Now, in Jim Muth's Fractal_Medallion (FOTD V3) the parameters are a = 1, b = -5, g = 1, h = -1, j = 1/6 The initial value of Z should therefore be z = -5 ^ (1/6) The correct answer is z = (1.13246720041135087, .653830243005915296) But Fracint is actually returning the conjugate! z = (1.13246720041135087, -.653830243005915296) 2. Bug Demonstration The formula CONJ-BUG-1 (attached) draws the X and Y axes, and also draws "axis lines" through 2 points, z and z2, where z and z2 are the result of a fixed calculation. It sets a, b, g, h and j as above, then calculates z = (-a*b*g*h)^j z2 = b^j Given the parameter values, clearly -a*g*h is 1, so z and z2 should be identical. The display has a grey background, and the axis lines are displayed as follows: (0,0) in black z in yellow z2 in dark red Where z and z2 correspond, the axis lines are blended. The result should be a pair of blended red/yellow lines through z = (1.13246720041135087, .653830243005915296) Run the parameter set CONJ-OK to verify this result. It specifies float=n In CONJ-BUG, however, float=y and the horizontal red and yellow lines are separated. The yellow line (imag(z)) has been reflected! 3. Bug Analysis a. Fractint appears to maintain a separate sign-bit for float values, but suffers from the rather disturbing condition that (n,0) and (n,-0) are two different numbers! This can be verified by substituting j = 1/6 z = -5^j z2 = conj(-5)^j into the CONJ-BUG formula. With float=y you get 2 different answers. b. The conditions under which a value (x,0) gets its sign-bit conjugated appear to be related to the use of the unary "-" operator. Try the CONJ-BUG formula with j = 1/6 b = -5, z = b^j b = 5, z2 = (-b)^j Here Z is correct, but Z2 is conjugated. c. !!!!! Late Extra !!!!! it's getting weird! NOW GET THIS! Simply changing the order of the 2 statements above affects the result! So if we have j = 1/6 b = 5, z2 = (-b)^j b = -5, z = b^j We get Z and Z2 in agreement, BUT both are wrongly conjugated!!!!! 4. Bug Impact Well, I've spent so bloody long just identifying this bug that I haven't had much time to consider the ramifications. I only stumbled across it because when I ran Jim Muth's Fractal Medallion on my home-grown Windows-based Fractint emulator - I got nothing at all, just a solid block of colour 9. I spent several days assuming my program was at fault until I discovered the "reflection" syndrome, and several more days before I was convinced my program was right, and Fractint was wrong. The MandelbrotMix4 formula just happens to be one that delivers a reflected image if the initial Z value is replaced with conj(Z), and just happens to have a particular expression for this initial value that is vulnerable to the "CONJ bug". There may of course be other formulae that are infected in more subtle ways. The fact that conj(x,0) and (x,0) can differ in a calculation is disturbing, but the most worrying aspect of all is that final test I ran (3.c above) which demonstrates that the occurrence of conjugation errors is by no means predictable, and can even be affected by the order of otherwise independent statements! 5. The Demo Formula/Params CONJ-BUG {; Dr Memory's CONJ bug demo ; ; plot axis lines ; (0,0) in colour 8 (black) ; z in colour 14 (yellow) ; z2 in colour 4 (dark red) ; all other points in colour 7 (grey) ; ; z and z2 axes plots are interlaced, so if z and z2 agree, ; the answer will be shown with mixed red/yellow axes. ; Any disagreement will be indicated by solid red/yellow lines ; ; Calculate Z and Z2 here! a = 1, b = -5, g = 1, h = -1, j = 1/6 z = (-a*b*g*h)^j ; the expression in question ; -a*g*h = 1, so z = b^j [i.e. -5 ^ (1/6)] z2 = b^j ; correct answer ; Axis-plot code - Set colour values according to pixel co-ordinates axis = real(p1) ; line thickness (in window co-ords) colour = 7 ; default bgnd colour ; always plot (0,0) in black (8) x = real(pixel), y = imag(pixel) if (abs(x) < axis) colour = 8 elseif (abs(y) < axis) colour = 8 endif ; plot z in yellow (14) if (abs(x - real(z)) < axis) colour = 14 elseif (abs(y - imag(z)) < axis) colour = 14 endif ; plot z2 in dark red (4) (blend with yellow if z/z2 agree) colour2 = 4 if (colour == 14) if (whitesq) colour2 = 14 endif endif if (abs(x - real(z2)) < axis) colour = colour2 elseif (abs(y - imag(z2)) < axis) colour = colour2 endif loopn = 0 : loopn = loopn + 1 loopn < colour } CONJ-BUG { ; CONJ bug demo PAR type=formula formulafile=??? formulaname=CONJ-BUG passes=1 float=y corners=-2.25/1.75/-1.75/1.25 params=0.01/0 maxiter=16 inside=0 symmetry=none map=default.map } CONJ-OK { ; CONJ bug avoided, float=n type=formula formulafile=??? formulaname=CONJ-BUG passes=1 float=n corners=-2.25/1.75/-1.75/1.25 params=0.01/0 maxiter=16 inside=0 symmetry=none map=default.map } __________________________________________________ It's Samaritans' Week. Help Samaritans help others. Call 08709 000032 to give or donate online now at http://www.samaritans.org/support/donations.shtm
On Monday 26 May 2003 02:27 pm, Jim White wrote:
In a nutshell, Fracint sometimes gets the imaginary sign wrong. Where you think you are getting -5 ^ x, you might actualy be getting conj(-5 ^ x). A little scary, yes?
Have you tried the command line option debugflag=322 ? I'm hoping this will fix the problem and we will have narrowed the problem to the optimized code. Changing the order of the statements is indicative of problems with the optimizations. Jonathan
participants (2)
-
Jim White -
Jonathan Osuch