I can offer some things I've learned from hacking at SFTC
see SFTC/Engine/approximation.cpp for details regarding this...
in the CalculateIterations() routine, with some help from knighty with pauldebrots idea for glitch detection and a lot of twiddling on my part...
long double EPSILON = 1.0E-13 * M_PI; /// E-13 too big, E-14 too small, something in between works best
long double BIGNUM = 1.0/EPSILON;
the first test is...
(in the approximation?)
long double zr=x+dx, zi=xi+dxi;
if((zr*zr+zi*zi)<EPSILON*(x*x+xi*xi)) return aDetails->GetIterationLimit()+1;
the second test is...
(if the approximation needs more iterations?)
if((std::min(fabs(c-dx),fabs(ci-dxi))/std::max(fabs(dx),fabs(dxi)) < EPSILON) ||
(std::max(fabs(c+dx),fabs(ci+dxi))/std::min(fabs(dx),fabs(dxi)) > BIGNUM)) {
return iterlim+1;
}
where iterlim+1 is the value used to flag glitch pixels for re-rendering after picking a new reference point ie:pass 2,3,4...
this seems to catch all glitches
see SFTC/Engine/approximation.cpp and SFTC/GUI/glwidget.cpp for details regarding this...
for scaling re:exponent I have set 2.225E-308 as the limit where scaling starts, I found a couple of references to the limits of type double,
1. smallest double = 2.2250738585072014e-308 w/o loosing precision
2. smallest accurately representable number = MaxExponent - mantissaBits = 272
I think 2 is the limit where you start to loose bits while 1 has a tolerance of 16 decimal places over the absolute smallest value the double type can hold 5e-324, using only 1 bit, not good for anything more than acting as a constant.
scaling is applied to
c and
ci when calculating the initial reference data and then in the CalculateIterations() routine to
delta and
deltai,
The voodoo magic is something of a mystery to me, I take it, largely, for granted that it works and thank folks like Kevin Martin, Pauldebrot Kalles and Knighty for sharing their discoveries and hard work. As my math skills are rudimentary at best, I can't offer any real insight or depth to the idea and appreciate any correction to my assumptions and guesses