Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29280 Discussions

how to make a NaN cause a floating point exception?

joerg_kuthe
Novice
1,105 Views
I am running IVF 10.1 under WinXP (32-Bit) and try to configure a project such that it causes a floating point exception if an expression evaluates to NaN (not a number).
According to the documentation I suspect that using /fpe:0 would cause this behaviour, but it does not seem to work. In the debugger I see that some elements of an array rs(:) become NaN when executing the statement
rs(i) = 3.D0*((a_(i+1)-a_(i))/h(i) - (a_(i)-a_(i-1))/h(i-1))
However, no exception. Did I misunderstand the documentation? Or, what do I have to do to cause the runtime system catch NaNs?

Joerg Kuthe
QT software

0 Kudos
4 Replies
Steven_L_Intel1
Employee
1,105 Views
/fpe:0 has an effect only if the main program is Fortran. Is yours?

In the upcoming version 11.1, there's a new option, /fpe-all, which can be used to specify behavior for all procedures even when the main program is not Fortran.
0 Kudos
joerg_kuthe
Novice
1,105 Views
Thank you for your prompt reply.
Yes, the main program is written in Fortran.
So far, only the numerical libraries which are built in "sub-projects" are configured with /fpe:0. Now, I also set /fpe:0 for the main project hoping that this would help. But it didn't change anything. The NaNs in my program do not cause an exception. Any idea what I can do before the release of 11.1?

All the best

Joerg Kuthe
0 Kudos
Steven_L_Intel1
Employee
1,105 Views
I doubt 11.1 will help you in this regard - but setting /fpe:0 on the main program was important. Does adding /fp:strict help? Can you provide a small test case that shows the problem?
0 Kudos
joerg_kuthe
Novice
1,105 Views
I doubt 11.1 will help you in this regard - but setting /fpe:0 on the main program was important. Does adding /fp:strict help? Can you provide a small test case that shows the problem?
No, setting /fp:strict didn't help either. The program I am working on is huge, so I have to check whether I can extract a bit to create a test case.

Joerg
0 Kudos
Reply