'bug' with Intel FORTRAN for Linux
From: glockner (glockner_at_enscpb.fr)
Date: 03/30/05
- Next message: Pavel: "Re: INTERFACE problem"
- Previous message: Gerald F. Thomas: "Wah Wah's Most Frequent Fortran Fallacy : how to call other program by compaq fortran"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Mar 2005 00:02:52 -0800
Hello,
I have a problem with Intel FORTRAN compiler (8.1.25) when the program
is optimized or not. It works well on anothers compilers (COMPAQ
VISUAL FORTRAN on Windows, SGI f90, HP-UX f90, ifort on IA64, f90 on
True64, g77 cygwin, g77 and g95).
The program is very simple.
If you put in a variable named V1 1.D0, in V2 again 1.D0, and you make
the operation V1-V2+1.D-20, you find 2 different results whatever you
optimize or not :
V1-V2+1.D-20 = 9.999999999999999E-021 (correct ; -O0)
V1-V2+1.D-20 = 0.000000000000000E+000 (optimized)
If you replace 1.D-20 by 1.D-14 :
V1-V2+1.D-14 = 1.000000000000000E-014 (correct ; -O0)
V1-V2+1.D-14 = 9.992007221626409E-015 (optimized)
It seems that V2+1.D-20 is the first operation made when optimized.
The behavior is strange compared with other compiler. Moreover, if you
put 1.D-20 in a variable named V3, it works well. So the way Intel
handle variable or numerical values such as 1.D-20 is different.
In the original program (more complex), the operation V1-V2+1.D-20 is
at the denominator of a division and produces NaN.
Here is a program test :
program test
double precision V1,V2,V3,V4
V1=1.D0
V2=1.D0
V3=1.D-20
V4=1.D0/(V1-V2+1.D-20)
print*,V4
V4=1.D0/(V1-V2+V3)
print*,V4
end
Working with numbers close to computer precision is dangerous but I
think that a compiler should not have such a problem (it is the only
one among the 9 compiler tested to produce such a result).
Any comments ?
Thanks
S. Glockner
- Next message: Pavel: "Re: INTERFACE problem"
- Previous message: Gerald F. Thomas: "Wah Wah's Most Frequent Fortran Fallacy : how to call other program by compaq fortran"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|