I am trying to use a third party automatic differentiation module, ADF95, which uses the expression -sqrt(asin(-1.0_dpr))
to return a Not-a-Number (NaN) in specific cases, where dpr
is defined using integer, parameter :: dpr = KIND(1.D0)
.
Upon attempting to compile a simple test program which uses the mod_adf95
module, with the command gfortran mod_adf95.f90 main.f90 -o test.exe
, I get several errors, such as:
mod_adf95.f90:2511:36:
f%deriv(1:lena) = -sqrt(asin(-1.0_dpr))*sign(1.0_dpr,a%value)
1
Error: Argument of SQRT at (1) has a negative value
Clearly the square root of a negative real
is undefined, and so I see why they would try to use this expression to get a NaN. So is there a way to tell the compiler to ignore these errors?