reporting an error from a REAL function



How should I report an error from a REAL function whose RESULT can take
on any value? I don't want to terminate the program within the
function. If it were a subroutine, I could use one argument as an error
flag. Most of my INTEGER functions returns counts, so I can return
negative integers to signal errors.

Should I set the function RESULT to NaN and then use the Fortran 2003
function ieee_support_nan() when it becomes available in the compilers
I use? I think some compilers have an isnan() function.

.