Re: Cheaper sinc computation for resize.c
Posted: 2010-08-30T02:58:29-07:00
More questions :
Q1:
Some IM constants (for example, those defined in image-private.h) are given with 50 decimal digits after the decimal point:
#define MagickPI 3.14159265358979323846264338327950288419716939937510
#define Magick2PI 6.28318530717958647692528676655900576839433879875020
#define MagickPI2 1.57079632679489661923132169163975144209858469968755
#define MagickSQ1_2 0.70710678118654752440084436210484903928483593768847
#define MagickSQ2 1.41421356237309504880168872420969807856967187537695
#define MagickSQ2PI 2.50662827463100024161235523934010416269302368164062
Is there anything special about 50 digits that I should know about, or can I assume that a long double never is larger than an IEEE binary128, which means that anything above 40 (39, really) decimal digits (before and after the decimal point) is a waste (according to http://en.wikipedia.org/wiki/IEEE_754-2008)? (40 decimal digits being twice what's needed for standard x86 extended precision, so that's covered too.)
(Note: I realize that, possibly, MagickPI will always be rounded to double when used macro-like. I'm just checking.)
Q2:
Does it make sense to "you" to include the key parameters of our methods in the code as follows?
MagickRealType c0,c1,c2,...,c13;
...
c1=-0.2777777749828003702607348742700210983971e-1L;
...
alpha=c0+x_squared*(c1+x_squared*(c2+...
(I'm trying to get a feel for IM coding style yet get the accuracy I know I can get. For example, I'm a const keyword addict, but clearly this is not standard IM practice, and it makes no difference with a good compiler so bye bye const.)
Q1:
Some IM constants (for example, those defined in image-private.h) are given with 50 decimal digits after the decimal point:
#define MagickPI 3.14159265358979323846264338327950288419716939937510
#define Magick2PI 6.28318530717958647692528676655900576839433879875020
#define MagickPI2 1.57079632679489661923132169163975144209858469968755
#define MagickSQ1_2 0.70710678118654752440084436210484903928483593768847
#define MagickSQ2 1.41421356237309504880168872420969807856967187537695
#define MagickSQ2PI 2.50662827463100024161235523934010416269302368164062
Is there anything special about 50 digits that I should know about, or can I assume that a long double never is larger than an IEEE binary128, which means that anything above 40 (39, really) decimal digits (before and after the decimal point) is a waste (according to http://en.wikipedia.org/wiki/IEEE_754-2008)? (40 decimal digits being twice what's needed for standard x86 extended precision, so that's covered too.)
(Note: I realize that, possibly, MagickPI will always be rounded to double when used macro-like. I'm just checking.)
Q2:
Does it make sense to "you" to include the key parameters of our methods in the code as follows?
MagickRealType c0,c1,c2,...,c13;
...
c1=-0.2777777749828003702607348742700210983971e-1L;
...
alpha=c0+x_squared*(c1+x_squared*(c2+...
(I'm trying to get a feel for IM coding style yet get the accuracy I know I can get. For example, I'm a const keyword addict, but clearly this is not standard IM practice, and it makes no difference with a good compiler so bye bye const.)