I am going to tweet about compiler options that trap floating point errors. There are

```
gfortran -ffpe-trap=invalid,zero,overflow
ifort -fpe0
```

What are the analogous options for other compilers?

## program to generate NaN

```
program test_nan
implicit none
real :: a, b, c
a = 0.0
b = 0.0
print*,"a, b=",a,b
print*,"computing c = a/b"
c = a/b
print*,"c=",c
end program test_nan
! output with gfortran trap_nan.f90
! a, b= 0.00000000 0.00000000
! computing c = a/b
! c= NaN
!
! output with gfortran -ffpe-trap=invalid trap_nan.f90
! a, b= 0.00000000 0.00000000
! computing c = a/b
! Program received signal SIGFPE: Floating-point exception -
! erroneous arithmetic operation.
!
! output for ifort -fpe0 trap_nan.f90
! a, b= 0.0000000E+00 0.0000000E+00
! computing c = a/b
! forrtl: error (65): floating invalid
```

## program to generate overflow

```
program test_overflow
real :: x
x = huge(x)
x = x**2
print*,x
end program test_overflow
! output with gfortran trap_overflow.f90
! Infinity
!
! output with gfortran -ffpe-trap=overflow trap_overflow.f90
! Program received signal SIGFPE: Floating-point exception
! - erroneous arithmetic operation.
!
! output for ifort -fpe0 trap_overflow.f90
! forrtl: error (72): floating overflow
```