Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Overflow

SCHWOERTZIG_T_
Beginner
311 Views

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
Steven_L_Intel1
Employee
311 Views

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.

0 Kudos
jimdempseyatthecove
Honored Contributor III
311 Views

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
Reply