seems it's bigger than a precision problem
any sugestions?
Code: Select all
//ACC
Moderator: Board moderators
Code: Select all
//ACC
Code: Select all
int test(double x,double y)
{
double zr=0,zi=0;
int k=0;
double d = 0;
while (d<=2.00000001 && k<=12)
{
zr = zr*zr - zi*zi;
// You have changed zr
zi = 2*zr*zi;
// You are using the wrong zr (updated one)
zr += x;
zi += y;
k++;
d= sqrt(zr*zr + zi*zi);
}
return k;
}
Code: Select all
row = floor((MaxI - MinI) / PrecI + 1e-12) + 1;
col = floor((MaxR - MinR) / PrecR + 1e-12) + 1;
for (i = 0; i < row; i++) {
for (j = 0; j < col; j++) {
}
}
Code: Select all
for (I = MinI; I <= MaxI; I += PrecI)
for (R = MinR; R <= MaxR; R += PrecR)
{
.......
}
Code: Select all
for (im = min_i; im <= max_i; im += prec_i) {
for (re = min_r; re <= max_r; re += prec_r) {
...
}
}
Hope it helps.The test is based on the equation Z = Z^2 + C. C represents a constant number, meaning that it does not change during the testing process. C is the number we are testing, the point on the complex plane that will be plotted when testing is complete.
Code: Select all
ACed[code]