Ecere Software
/
sdk
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f89a6fd
)
samples/mandelbrot: Taking out the sqrt()
author
Jerome St-Louis
<jerome@ecere.com>
Fri, 1 Apr 2016 22:42:41 +0000
(18:42 -0400)
committer
Jerome St-Louis
<jerome@ecere.com>
Fri, 29 Apr 2016 16:27:01 +0000
(12:27 -0400)
- log(x^c) = c log(x) !!!!
samples/guiAndGfx/mandelbrot/mandelbrot.ec
patch
|
blob
|
history
diff --git
a/samples/guiAndGfx/mandelbrot/mandelbrot.ec
b/samples/guiAndGfx/mandelbrot/mandelbrot.ec
index
18294c3
..
1c31cab
100644
(file)
--- a/
samples/guiAndGfx/mandelbrot/mandelbrot.ec
+++ b/
samples/guiAndGfx/mandelbrot/mandelbrot.ec
@@
-31,15
+31,15
@@
void drawMandelbrot(Bitmap bmp, float range, Complex center, ColorAlpha * palett
bool out = false;
for(i = 0; i < nIterations; i++)
{
- double z
m
;
+ double z
2
;
Z = { Z.a*Z.a - Z.b*Z.b, Z.a*Z.b + Z.b*Z.a };
Z.a += C.a;
Z.b += C.b;
- z
m = sqrt(Z.a * Z.a + Z.b * Z.b)
;
+ z
2 = Z.a * Z.a + Z.b * Z.b
;
- if(z
m >=
2)
+ if(z
2 >= 2*
2)
{
- ii = (double)(i + 1 - log(
log(zm
)) / logOf2);
+ ii = (double)(i + 1 - log(
0.5 * log(z2
)) / logOf2);
out = true;
break;
}