- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everybody,
I'm trying to find where inside my program appears the first NaN var. So I created the following function:
logical FUNCTION testanan(var) implicit none real(8) var if (var /= var) then print*, 'deu NAN na', var TESTANAN=.TRUE. READ(*,*) endif ENDFUNCTION
I run in debug mode and when the message appears in the screen, I press pause to find out in which line the NaN appears. But when I do that, deadlock happens...
How can I identify where is my first NaN happens?
Regards
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why not remove the READ and place a debugger break point on TESTNAN=?
Then when break is hit, single step out of the function.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I second Jim's comments.
NOTE: If "var /= var" is false, the function value is undefined.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot Jim, I will try your suggestion and I gonna fix the result.
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please don't use var /= var to test for NaN. Use the intrinsic IEEE_ISNAN from intrinsic module IEEE_ARITHMETIC. The compiler might choose to delete your comparison under normal optimization. If you want to do such tests, you must compile with the option /fp:strict

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