Parent document is top of "comp.unix.aix Frequently Asked Questions (Part 4 of 5)"
Previous document is "3.02: How do I statically bind Fortran libraries and dynamically bind C libraries?"
Next document is "3.04: Some info sources on IEEE floating point."
3.03: How do I check if a number is NaN?
From: sdl@glasnost.austin.ibm.com (Stephen Linam)
NaN is "Not a Number". It arises because the RISC System/6000 uses
IEEE floating point arithmetic.
To determine if a variable is a NaN you can make use of the property
that a NaN does not compare equal to anything, including itself.
Thus, for real variable X, use
IF (X .NE. X) THEN ! this will be true if X is NaN
Floating point operations which cause exceptions (such as an overflow)
cause status bits to be set in the Floating Point Status and Control
Register (FPSCR). There is a Fortran interface to query the FPSCR, and
it is described in the XLF Fortran manuals -- I don't have the manuals
right here, but look for FPGETS and FPSETS.
The IBM manual "Risc System/6000 Hardware Technical Reference - General
Information" (SA23-2643) describes what floating point exceptions can
occur and which bits are set in the FPSCR as a result of those exceptions.
Parent document is top of "comp.unix.aix Frequently Asked Questions (Part 4 of 5)"
Previous document is "3.02: How do I statically bind Fortran libraries and dynamically bind C libraries?"
Next document is "3.04: Some info sources on IEEE floating point."