- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am use Intel Fortran XE 17 update 4
Previously the following code sets the real variable to a very large negative value
real :: no_lower = -HUGH(1.0)
Now the variable is set to zero. Did something change in the Fortran standard?
Thanks for your help.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you actually write HUGH or HUGE? I get the correct value (in version 18) with HUGE.
Please show a short but complete example that demonstrates the problem, the compilation command you used and the output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If he actually wrote "HUGH", that would be a non-standard function, and the linking of the program would have failed, unless there was a function called HUGH in the user's code or in some library provided by the user. Therefore, it is mysterious how the program could have been compiled, linked and run to the point where it produced output, erroneous as that output might have been!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I actually used HUGE(1.0). Sorry for the typo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I figured as much - and yes, HUGH would have triggered multiple errors. Please show an example that demonstrates the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's a program that demonstrates the issue:
! T_HUGE.f90
!
! FUNCTIONS:
! T_HUGE - Entry point of console application.
!
!****************************************************************************
!
! PROGRAM: T_HUGE
!
! PURPOSE: Entry point for the console application.
!
!****************************************************************************
program T_HUGE
implicit none
! Variables
real :: no_upper_limit = HUGE(1.0)
real :: no_lower_limit = -HUGE(1.0)
! Body of T_HUGE
print *, 'Hello World'
print *, 'no_upper_limit =', no_upper_limit
print *, 'no_lower_limit =', no_lower_limit
print *,'<press return to end>'
read *
end program T_HUGE
Command line:
/nologo /debug:full /Od /warn:interfaces /fpconstant /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc150.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c
Output:
Hello World
no_upper_limit = 3.4028235E+38
no_lower_limit = 0.0000000E+00
<press return to end>
The critical option is /fpconstant. Without it the no_lower_limit = -3.4028235E+38
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the more complete information. That's a compiler bug, still present in 18. Please report it to Intel using the Online Service Center.
In the meantime I would recommend against using /fpconstant - this option should be avoided anyway as it papers over nonportable and nonstandard code.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page