Project: BigDouble
Introduction
As I was working on my Julia Set matings, project, I quickly realized that the animations would quickly fail when using unbounded Julia Sets. This was due to the fact that their orbits quickly diverge to infinity, whereas C#’s maximum value for doubles is only 2^1024 - a well known limitation of the algorithm, as explained in this paper. Still, the animations I tested with unbounded Julia Sets looked like they could still go on, and I noticed that the resulting values from the pull-back iterations were all numbers in the single digits. As such, I reasoned that all I need to do is to bypass the maximum value limitation to continue the animation, and promptly looked for arbitrary-precision solutions for C#. However, it became apparent that this wasn’t exactly what I needed, as using arbitrary precision would dramatically decrease performance and my project would no longer function in real-time (which is already a challenge for this project). Furthermore, the specific issue here isn’t the double precision (15-17 digits), but rather simply the limitation of the maximum value. As such, I decided to create my own class that could increase the maximum value without increasing the precision used. Naming it BigDouble, this class represents values in scientific notation and performs all arithmetic in this form, thus effectively increasing the maximum limit to 9.99x10^2,147,483,647 (the maximum value for C#’s integers). Finally, after creating the BigComplex class to use BigDouble with complex numbers, this project could now show matings between unbounded Julia Sets - which was used to create this animation. See the project’s gallery for more examples.
Features
The C# implementation for both BigDouble and BigComplex can be found here.
BigComplex
BigDouble
BigDouble(double)
BigDouble(double, int)
string ToString(self)
int ToInt(self)
double ToDouble(self)
BigDouble FromInt(int)
BigDouble FromDouble(double)
bool operator float(BigDouble)
bool operator double(BigDouble)
bool operator ==(BigDouble, BigDouble)
bool operator !=(BigDouble, BigDouble)
bool operator <
(BigDouble, BigDouble)
bool operator >
(BigDouble, BigDouble)
BigDouble operator +(BigDouble, BigDouble)
BigDouble operator -(BigDouble)
BigDouble operator -(BigDouble, BigDouble)
BigDouble operator *
(BigDouble, BigDouble)
BigDouble operator /(BigDouble, BigDouble)
BigDouble operator ^(BigDouble, int)
BigDouble operator ^(double, BigDouble)
int Sign(self)
BigDouble Abs(BigDouble)
BigDouble Invert(BigDouble)
BigDouble Sqrt(BigDouble)
int GetExponent(double)
int GetDigitNum(double)
int GetLeadingZeroNum(double)
BigDouble Simplify(self)
bool IsZero(BigDouble)
bool IsNaN(BigDouble)
bool IsInfinity(BigDouble)
bool IsPositiveInfinity(BigDouble)
bool IsNegativeInfinity(BigDouble)
BigComplex(double, double)
BigComplex(BigDouble, BigDouble)
string ToString(self)
bool operator ==(BigComplex, BigComplex)
bool operator !=(BigComplex, BigComplex)
BigComplex operator +(BigComplex, BigComplex)
BigComplex operator -(BigComplex)
BigComplex operator -(BigComplex, BigComplex)
BigComplex operator *
(BigComplex, BigComplex)
BigComplex operator /(BigComplex, BigComplex)
BigComplex operator ^(BigComplex, int)
BigDouble Magnitude(BigComplex)
BigComplex Normalize(BigComplex)
int Sign(BigComplex)
double Arg(BigComplex)
BigComplex Inverse(BigComplex)
BigComplex Sqrt(BigComplex)
BigComplex Proj(BigComplex)
bool IsZero(BigComplex)
bool IsNaN(BigComplex)
bool IsInfinity(BigComplex)
bool IsPositiveInfinity(BigComplex)
bool IsNegativeInfinity(BigComplex)