How to detect NaN's

lawrence brown elwin at hubcap.clemson.edu
Tue Jun 4 00:30:50 AEST 1991


>From article <1991May30.204332.16506 at litwin.com>, by vlr at litwin.com (Vic Rice):
> I have encountered a problem on a DECStation 5000 using the Mips Fortran
> compiler. Some operation I am performing is generating a NaN which then
> proceeds to propogate to other dependent variables. Since this is in
> a loop, I am not exactly sure where it starts.
> 
> How can I test a variable for the presence of a NaN or Infinity ???
> -- 
> Dr. Victor L. Rice
> Litwin Process Automation
Our compiler (Fortran for RISC version 2.0 I think) has a barely
documented option that will trap any NaN's and generate an illegal
instruction error.  It also sets all variables to NaN at the beginning
of execution (rather than setting them to zero) so it will test for 
unassigned variable usage (e.g. misspelled variable names). Try
f77 -trapuv
Hope this helps.
Larry Brown



More information about the Comp.unix.ultrix mailing list