2 ! { dg-add-options ieee }
3 ! { dg-skip-if "NaN not supported" { spu-*-* } }
5 ! List-directed part of PR fortran/43298
6 ! and follow up to PR fortran/34319.
8 ! Check handling of "NAN(alphanum)"
10 character(len
=200) :: str
17 str
= 'INfinity' ; read(str
,*) r
18 if (r
< 0 .or
. r
/= r
*1.1) call abort()
21 str
= '-INF' ; read(str
,*) r
22 if (r
> 0 .or
. r
/= r
*1.1) call abort()
25 str
= '+INF' ; read(str
,*) r
26 if (r
< 0 .or
. r
/= r
*1.1) call abort()
29 str
= '-inFiniTY' ; read(str
,*) r
30 if (r
> 0 .or
. r
/= r
*1.1) call abort()
33 str
= 'NAN' ; read(str
,*) r
34 if (.not
. isnan(r
)) call abort()
37 str
= '-NAN' ; read(str
,*) r
38 if (.not
. isnan(r
)) call abort()
41 str
= '+NAN' ; read(str
,*) r
42 if (.not
. isnan(r
)) call abort()
45 str
= 'NAN(0x111)' ; read(str
,*) r
46 if (.not
. isnan(r
)) call abort()
49 str
= '-NAN(123)' ; read(str
,*) r
50 if (.not
. isnan(r
)) call abort()
53 str
= '+NAN(0xFFE)' ; read(str
,*) r
54 if (.not
. isnan(r
)) call abort()
60 str
= '(0.0,INfinity)' ; read(str
,*) z
61 if (aimag(z
) < 0 .or
. aimag(z
) /= aimag(z
)*1.1) call abort()
64 str
= '(-INF,0.0)' ; read(str
,*) z
65 if (real(z
) > 0 .or
. real(z
) /= real(z
)*1.1) call abort()
68 str
= '(0.0,+INF)' ; read(str
,*) z
69 if (aimag(z
) < 0 .or
. aimag(z
) /= aimag(z
)*1.1) call abort()
72 str
= '(-inFiniTY,0.0)' ; read(str
,*) z
73 if (real(z
) > 0 .or
. real(z
) /= real(z
)*1.1) call abort()
76 str
= '(NAN,0.0)' ; read(str
,*) z
77 if (.not
. isnan(real(z
))) call abort()
80 str
= '(0.0,-NAN)' ; read(str
,*) z
81 if (.not
. isnan(aimag(z
))) call abort()
84 str
= '(+NAN,0.0)' ; read(str
,*) z
85 if (.not
. isnan(real(z
))) call abort()
88 str
= '(NAN(0x111),0.0)' ; read(str
,*) z
89 if (.not
. isnan(real(z
))) call abort()
92 str
= '(0.0,-NaN(123))' ; read(str
,*) z
93 if (.not
. isnan(aimag(z
))) call abort()
96 str
= '(+nan(0xFFE),0.0)' ; read(str
,*) z
97 if (.not
. isnan(real(z
))) call abort()