- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Fortran fraternity
I assign a real variable to zero. but when i debug the program, I see that variable value as NaN without any operation having taken place. what could be the reason and what is the remedy. i am using visual studio 8.
Advise please.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There must be more to this than what you say. For example, if I create the following
PROGRAM MAIN REAL :: A A = 0 END PROGRAM MAIN
and run it in debug, I get 0 for A. NaN is typically generated in REAL values as 0.0 / 0.0 or 0.0 times infinity. There must be something along these lines generating the value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or you are debugging a program with optimizations and the variable may live in a register or in memory dependent upon where the break point is located. The debugger will display the memory location only. You will not see this behavior in Debug build (with no optimizations). Also optimization may eliminate statements deemed unnecessary
A=0.0
{ A not used between above statement and next statement }
A=1.0
Optimization, with the above qualification, can eliminate the A=0.0
Jim Dempsey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page