"sinl(x) = 0.70710678118654750275", Indeed!

"sinl(x) = 0.70710678118654750275", Indeed!

You gave,

"sinl(x) = 0.70710678118654750275", (1)

which should better be,

"sinl(x) = 0.70710678118654752440", (2)

I believe.
You could have improved your result by coding,

"long double pi_by_four = 3.141592653589793238L/4.0;" (3)

instead of,

"long double pi_by_four = 3.141592653589793238/4.0;", (4)

I believe.

Nota bene:

1: Equation (1) was copied from Intel C++ Compiler Reference,
Document Number: 307777-004US, P. 29;

2: Equation (2) was generated from a "bc -l" 1.06 session and should
be correct, including rounding, to the precision displayed;

3: Statement (3) would be my suggestion to make the pi approximation
constant of type "long double" instead of just "double", however, I did
not try it using your icpc Compiler; and

4: Statement (4) was copied from Intel C++ Compiler Reference,
Document Number: 307777-004US, P. 28.

Happy Hol[y]days!

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

This is a fair point. Without the L suffix, the compiler is required to round the constant to type double (53 bits precision, 15 to 17 digits signficance). With the L suffix, you have available the additional 11 bits of precision. With insertion of fldpi instruction by asm, you may get another 2 bits of precision. Apparently, the poster had errors outside of those in the posted code.

Dear Tim (?):

Thank you for your response!
I'll try your icpc Compiler for the code example on P. 28, & get back
to you with a result if you'd like.
I've been trying your ifort Compiler, and was impressed by the
"Quad or Extended Precision (IEEE_X)*", "*This type is emulated
in software." (ref.: Intel Fortran Floating-point Operations. Document
Number: 315892-003US, Pp. 23 & 24) capability, yielding ~ 33
significant decimal digits of floating-point precision.
Can a Core 2 Quad based PC give ~ 33 digits using a hardware set of
instructions which should be much faster than software emulation, please?
I would appreciate the ~ 33 digits from both a Fortran and a C/C++ Compiler.
Any information/guidance would be appreciated.
Happy Hol[y]days!

If you haven't read them, you might be interested in the earlier posts about the 128-bit long double. It's the same in ifort and icc, except that icc doesn't include library support. There is no single instruction hardware support for more than 80-bit long double. Quad core gives you the ability to execute more threads simultaneously, but it makes no difference to data type support.

Leave a Comment

Please sign in to add a comment. Not a member? Join today