isNaN
Tests for NaN.
Function Return Value
Logical indicating whether or not A contains NaN. The output value tests .true. only if there is at least one NaN in the scalar or array. (Output)
Required Argument
A — The argument can be a scalar or array of rank-1, rank-2 or rank-3. The values can be any of the four intrinsic floating-point types. (Input)
FORTRAN 90 Interface
isNaN( A)
Description
This is a generic logical function used to test scalars or arrays for occurrence of an IEEE 754 Standard format of floating point (ANSI/IEEE 1985) NaN, or not-a-number. Either quiet or signaling NaNs are detected without an exception occurring in the test itself. The individual array entries are each examined, with bit manipulation, until the first NaN is located. For non-IEEE formats, the bit pattern tested for single precision is transfer(not(0),1). For double precision numbers x, the bit pattern tested is equivalent to assigning the integer array i(1:2) = not(0), then testing this array with the bit pattern of the integer array transfer(x,i). This function is likely to be required whenever there is the possibility that a subroutine blocked the output with NaNs in the presence of an error condition.
Example

use isnan_int
implicit none

! This is the equivalent of Example 1 for NaN.
integer, parameter :: n=3
real(kind(1e0)) A(n,n); real(kind(1d0)) B(n,n)
real(kind(1e0)), external :: s_NaN
real(kind(1d0)), external :: d_NaN

! Assign NaNs to both A and B:
A = s_Nan(1e0); B = d_Nan(1d0)

! Check that NaNs are noted in both A and B:
if (isNan(A) .and. isNan(B)) then
write (*,*) 'Example 1 for NaN is correct.'
end if

end
{"ft_lang_label":"__label__en","ft_lang_prob":0.72861433,"math_prob":0.97440857,"size":1630,"snap":"2023-14-2023-23","text_gpt3_token_len":423,"char_repetition_ratio":0.089175895,"word_repetition_ratio":0.0,"special_character_ratio":0.2576687,"punctuation_ratio":0.13529412,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9917547,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-05-30T19:58:22Z\",\"WARC-Record-ID\":\"<urn:uuid:09670e44-e7a3-4286-8908-04a9bf4504b8>\",\"Content-Length\":\"9533\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ea8e335d-58fd-4e99-8dad-9b2ed9db1f0f>\",\"WARC-Concurrent-To\":\"<urn:uuid:708de3ac-18e7-4475-a0d9-e5c019a85c26>\",\"WARC-IP-Address\":\"20.98.105.60\",\"WARC-Target-URI\":\"https://help.imsl.com/fortran/2021.0/html/fnlmath/FNLMath/mch10.12.29.html\",\"WARC-Payload-Digest\":\"sha1:IJENY7OW7RBK5SC2D4L36BIMLYA4KYKB\",\"WARC-Block-Digest\":\"sha1:BFIZ63Q5JASNAVPD6DD7623ZH2KYSVQ2\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224646144.69_warc_CC-MAIN-20230530194919-20230530224919-00089.warc.gz\"}"}