- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ps. It is the compiler for Linux.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page