Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29276 Discussions

bug report: intel fortran compiler 9.1, intrinsic function dcosd

shiyin
Beginner
780 Views
Try this code:

program testRa
double precision:: ra

Ra=359.9
print *,dcosd(Ra),dcosd(Ra-360)

end

compile with ifort (v9.1)

The output is
0.768461121150065 0.999998476727358

The first number is obviously wrong!!!

Using compiler ifc7.1, the output is correct.

0 Kudos
3 Replies
shiyin
Beginner
780 Views
ps. It is the compiler for Linux.
0 Kudos
TimP
Honored Contributor III
780 Views
When you take so many risks in your code, a number of things can go wrong, depending on the options you choose, and exact compiler version. What happens if you declare dcosd, and change 359.9 to a double precision constant?
I don't see a problem until the 10th digit when I run this, but I'm sure I don't have the same compiler build.
0 Kudos
Steven_L_Intel1
Employee
780 Views
dcosd is an intrinsic so you don't need to declare it. Tim is correct that the 359.9 should be 359.9D0, but that doesn't make a large difference.

I can't reproduce the results you are seeing. I get:

0.999998476727358 0.999998476727358

if I use 359.9D0 I get:

0.999998476913288 0.999998476913288

What is the exact version of the compiler you are using? If 9.1.037, which is the latest, please send a test case to Intel Premier Support.
0 Kudos
Reply