An elemental IEEE function. Tests whether a value is IEEE Not-a-Number. Returns true if IEEE_CLASS(X) has the value IEEE_SIGNALING_NAN or IEEE_QUIET_NAN. It returns false otherwise.
IEEE_ARITHMETIC
Where X is of type real.
Where the result is of type default logical.
To ensure compliance with the Fortran 2003 standard, the IEEE_SUPPORT_DATATYPE(X) and IEEE_SUPPORT_NAN(X) must return with a value of true.
USE, INTRINSIC :: IEEE_ARITHMETIC
REAL :: X = -1.0
IF (IEEE_SUPPORT_DATATYPE(X)) THEN
IF (IEEE_SUPPORT_SQRT(X)) THEN ! IEEE-compliant SQRT function
IF (IEEE_SUPPORT_NAN(X)) THEN
PRINT *, IEEE_IS_NAN(SQRT(X)) ! Prints true
ENDIF
ENDIF
ENDIF
USE, INTRINSIC :: IEEE_ARITHMETIC
REAL :: X = -1.0
IF (IEEE_SUPPORT_STANDARD(X)) THEN
PRINT *, IEEE_IS_NAN(SQRT(X)) ! Prints true
ENDIF