Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner

Overflow

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

0 Kudos
2 Replies
Highlighted

With -fpe0 you get an error

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.

Retired 12/31/2016
0 Kudos
Highlighted

You could set -fpe0, then

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

0 Kudos