C Library Functions - is_nan (3)
NAME
is_nan(3f) - [M_units] determine if integer is a Nan (Not a Number) value
(LICENSE:PD)
CONTENTS
Synopsis
Description
Options
Example
Author
License
SYNOPSIS
elemental pure logical is_nan(value)
integer(kind=real32|real64|real128|complex) :: value
DESCRIPTION
Determine if a real or complex value is a NaN (Not a Number) value
OPTIONS
EXAMPLE
simple example
program demo_is_nan
use M_units, only : is_nan
real :: x
character(len=*),parameter :: linei=Infinity
character(len=*),parameter :: line=NaN
character(len=:),allocatable :: readable
real,parameter :: arr(*)=[-100.0,100.0,huge(0.0)]
readable=linei
read(readable,*)x
write(*,*)is_nan(x),x ! note Infinity is not a Nan
write(*,*)is_nan(-x),-x
readable=line
read(readable,*)x
write(*,*)is_nan(x),x
write(*,*)x==x,x ! note Nan is never equal to another value
write(*,*)is_nan(arr),arr
end program demo_is_nan
Expected results
F Infinity
F -Infinity
T NaN
F NaN
F F F -100.000000 100.000000 3.40282347E+38
AUTHOR
John S. Urban
LICENSE
Public Domain
| Nemo Release 3.1 | is_nan (3) | June 29, 2025 |
Generated by manServer 1.08 from f124c5f7-3d31-486c-98ae-9c8593fdf0e4 using man macros.