Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Compiler bug - floating point invalid

$
0
0

The following code produces a floating point invalid error at run-time when using the flags -O2 -fpe0 -fltconsistency:

program example

   integer, parameter :: leng = 300
   real (kind = 8), dimension(leng) :: errors
   integer :: i

   do i = 1, leng
      errors(i) = 1d-20 * sin(float(i))
   end do

   print*, minval(errors)

   where(errors < 0) errors = -100.0_8 * errors / minval(errors)

end program example

This occurs at the line beginning "where".  This is also sometimes a problem for maxval, but it was easier to recreate with minval.  If a new real(8) is created to hold the value of minval(errors) before the where, this fixes the problem.  Also, removing the fltconsistency flag fixes the problem.

-Dave


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>