I'm working on a new version of my Mandelbrot screensaver and I'm running out of floating point accuracy - simple double values don't have enough significant figures for my needs.
More significant figures = greater levels of zooming into the fractal
Back when I wrote a version of this screensaver in Delphi 7, I used the extended floating point type, 80 bits in size.
In .NET, I could switch to decimal, but the performance hit for this is terrible, slowing down fractal generation by a factor of 20 or so.
Is there any equivalent of extended for .NET? Or, alternatively, are there any numeric types with higher precision than double that still use the FPU for evaluation and therefore don't have the high performance hit of decimal?
Update
My screensaver already manages to zoom into the fractal by many (many!) orders of magnitude; currently it resets to the base fractal only when the numeric type in use is unable to separate the ordinates for adjacent pixels. The extra 16 bits of precision from the double-extended improvement would give me close to 16 more doublings of size.
As to performance, my algorithm already manages to eliminate 95-99% of the math required (as compared to a naive implementation that calculates many pixels), while retaining the integrity of the fractal.
Long long signed integer type. Capable of containing at least the [−9,223,372,036,854,775,807, +9,223,372,036,854,775,807] range. Specified since the C99 version of the standard.
Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are static methods, but they're called as if they were instance methods on the extended type.
Long Integer Size The size is typically about 32-bits or 4 bytes on a 16/ 32-bit compiler.
The double in C is a data type that is used to store high-precision floating-point data or numbers (up to 15 to 17 digits). It is used to store large values of decimal numbers. Values that are stored are double the size of data that can be stored in the float data type. Thus it is named a double data type.
On 64-bit platforms, the
Extended
type is an alias for Double, which is only 8 bytes. On 32-bit platforms, anExtended
number is represented as 10 bytes (80 bits).
That means even your Delphi program may not perform well in 64bit platforms.
If you need a numeric data type with more than 64bits then go for decimal
and optimize your algorithms to improve performance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With