- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I would like to detect high values in my program like 1e30. (real*4 or real*8)
With -fpe0 compiler option, the limit to detect overflows are 1e39 (real*4) and 1e69(real*8). Is it possible to configure this limit in order to decrease it ?
Best Regrds
Thierry
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
With -fpe0 you get an error when a value exceeds the range of the datatype, which is based on the processor detecting an exception. For single precision that is about 1E38 and for double precision, 1E308. You can't control the limit for overflow checking.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could set -fpe0, then insert into your code
real, parameter :: TooBig = huge(real) - YourUpperLimit
real, volatile :: waste ! ensure compiler does not optimize stores out of the code
...
waste = TestingNumber + TooBig ! will generate fpe on overflow
Expand on this for negative and real(8)
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