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

Floating point - NaN - underflow ?

neosonic
Beginner
1,920 Views
Hi everyone

Iam using Visual Studio 2008 with IVF11.0.061 on Windows XP. Since I migrated from CVF6, I have beginers problem on this environment.

In this simple code variables STEP,x(2)...x(200),y(2)...y(200) have values NaN, and x(1)=-3.14, y(1)=0.0

program Test1
implicite none
REAL x(200),y(200), step

INTEGER i
x(1)=-3.14
y(1)=0.0
step=6.28/199.
print *, x(1),y(1),step
DO i=2,200
x(i)=step+x(i-1)
y(i)=sin(x(i))
print *, x(i),y(i)
END DO
end program TEST1


If I change y(1)=1.0E-37, everithingbecome OK. x(1)=-3.14, y(1)=9.9999e-38 (almost zero), step=3.1557791e-02, and all other values of x(i) and y(i) are correct.

I have a lot of old source code from CVF6, and it is very hard to change all zeros.

I also tried to change
Project>TEST1 Properties..>Fortran>Floating Point>Floating-Point Exception Handling> /fpe:0
but program break with message:
Unhandled exception at 0x7c92a911 in test1.exe: 0xC0000005: Access violation writing location 0x00030fd8.

If I change /fpe:0 in /fpe:1, problem still persist like in the begining.

I will appreciate any help. Thank You.

0 Kudos
8 Replies
mecej4
Honored Contributor III
1,920 Views
> In this simple code variables STEP,x(2)...x(200),y(2)...y(200) have values NaN, and x(1)=-3.14, y(1)=0.0

That is not a valid statement without your having specified at what point in the program this refers to. After all, your program performs calculations and assigns new values (assuming that you have correctly spelled "implicit") to variables, so a blanket statement such as this, seeming to apply to the entire duration of a run of the program, cannot stand.

The program with implicite corrected to implicit, runs to completion with no access errors. This short, trivial, program exposes no CVF -> IVF migration issues.

The reported access violation is not in your code, but in some system library. You may try to use a more recent version of the compiler and see if the problem has been fixed.

0 Kudos
neosonic
Beginner
1,920 Views
I am sorry. I made mistake in my text, not inmy program. I wrote implicite instead implicit.
But everithing other is correct.
The values NaN are the final results of the program.
Thank you.
0 Kudos
Steven_L_Intel1
Employee
1,920 Views
I tried your program with 11.0.061 and did not see any NaNs or other odd behavior. Can you show me the exact command used to compile? If you did this in Visual Studio, attach the buildlog.htm from the Debug or Release folder.
0 Kudos
mecej4
Honored Contributor III
1,920 Views
Let us not make things more complicated than they need to be. The longer the toolchain used to build a program, the more the number of malfunctioning links to examine.

Your build-log shows that a manifest file was involved at the link step, possibly because of a setting in VisualStudio. In some circumstances, running a program with a mismatched manifest can cause access violations.

Please repeat the build attempt with manifests turned off.
0 Kudos
Steven_L_Intel1
Employee
1,920 Views
The manifest is not the problem - Visual Studio configures use of a manifest by default. There is nothing wrong with the way you integrated Fortran into VS but I still can't reproduce the problem. Please show the output of the program you built from the log you attached earlier.
0 Kudos
anishtain4
Beginner
1,920 Views
Tried your codes
first one worked perfectly,
at first compilation second code returned a manifestation error, but when I compiled it again it worked fine too and error didn't show up later too.

my first action at this situations would be a reinstall of vs and ifort
0 Kudos
bmchenry
New Contributor II
1,920 Views

likewise i had tried it here...no issue.
I would guess that it's aconflict on libraries?
(I recall back a few versions ago there was an issue with ifort? being the same on another fortran compiler?
what other fortran compilers or other compilers do you have installed on the computer?
particulalry do you have any other in the Visual Studio environment (I run different fortran compilers on different versions of Visual Studio since they don't like sharing attention!)

0 Kudos
neosonic
Beginner
1,920 Views
I have installed Compac Visual Fortran 6.6 and everithing works perfect. On Microsoft Visual Studio 2008 I integrated only IVF11.0.06. Maybe anishtain4 is right advising me to reinstall everithing. Thanks both of you.
0 Kudos
Reply