I've had no issues creating the initial plugin but the fixed high precision maths section just comes up blank (either completely black - e.g. reached infinity or blue - e.g. bailed out).
Also the julias are different to how they appeared on FractInt.
Here's the code for each section, I don't know what's wrong. Anyone see anything I've overlooked?
Firstly, the low precision stuff:
FXEXPORT int CalcJuliaFloat(int EquationID, struct FloatParams *pParams)
{
double zr = pParams->cr;
double zi = pParams->ci;
double JuliaR = pParams->JuliaR;
double JuliaI = pParams->JuliaI;
int MaxIters = pParams->MaxIters;
double OverFlowPoint = pParams->OverFlowPoint;
double zrsqr = 0;
double zisqr = 0;
double zrabs, ziabs, tempzi, tempzr;
int count = 0;
switch (EquationID)
{
case FT_Simon100A:
for (/**/; count < MaxIters && zrsqr + zisqr < OverFlowPoint; count++)
{
zrabs = abs(zr);
ziabs = abs(zi);
tempzi = zi*zrabs+zr*ziabs;
tempzr = zr*zrabs-zi*ziabs;
zi=tempzi;
zr=tempzr;
zrsqr = zr * zr;
zisqr = zi * zi;
zi = zr * zi * 2.0 + JuliaI;
zr = zrsqr - zisqr + JuliaR;
zisqr = zi * zi;
zrsqr = zr * zr;
}
break;
}
pParams->cr = zr;
pParams->ci = zi;
if (count > MaxIters)
{
// It is not legal to return a count value that is greater than MaxIters.
__debugbreak();
count = MaxIters;
}
if (count < 0)
{
// It is not legal to return a count value that is negative.
__debugbreak();
count = 0;
}
return count;
}
Secondly, the high precision stuff:
// Initialize our numbers from the fixed-point data passed in.
HighPrecMath zr(pParams->cr + offset, precision);
HighPrecMath zi(pParams->ci + offset, precision);
HighPrecMath JuliaR(pParams->JuliaR + offset, precision);
HighPrecMath JuliaI(pParams->JuliaI + offset, precision);
int MaxIters = pParams->MaxIters;
HighPrecMath zrsqr = zr - zr;
HighPrecMath zisqr = zrsqr;
HighPrecMath zrabs = zr;
HighPrecMath ziabs = zi;
HighPrecMath tempzi = zi;
HighPrecMath tempzr = zr;
HighPrecMath zrziabs = zr;
HighPrecMath ziziabs = zi;
int count = 0;
switch (EquationID)
{
case FT_Simon100A:
for (/**/; count < MaxIters && !(zrsqr + zisqr).Overflow(); count++)
{
// Using *= and += instead of * and + avoids the creation of expensive
// temporaries and can be a very important optimization.
// Combining the fixed-point shifting of 'zi *= zr' with the shifting
// by one of zi (multiplication by two) can save some time.
zrabs = zr;
if(zrabs.IsNegative()) zrabs.negate();
ziabs = zi;
if(ziabs.IsNegative()) ziabs.negate();
tempzi = zi; tempzi *= zrabs;
zrziabs = zr; zrziabs *= ziabs;
tempzi += zrziabs;
tempzr = zr; tempzr *= zrabs;
ziziabs = zi; ziziabs *= ziabs;
tempzr -= ziziabs;
zi = tempzi;
zr = tempzr;
zrsqr = zr; zisqr *= zr;
zisqr = zi; zisqr *= zi;
zi *= zr;
zi <<= 1; zi += JuliaI; //zi = |zi * zr| * 2 - JuliaI;
zrsqr -= zisqr; zrsqr += JuliaR; zr = zrsqr; //zr = zrsqr - zisqr - JuliaR;
zisqr = zi; zisqr *= zi; // zisqr = zi * zi;
zrsqr *= zrsqr; // zrsqr = zr * zr;
}
break;
}
Hope it makes sense...