2 ! { dg-add-options ieee }
4 ! List-directed part of PR fortran/43298
5 ! and follow up to PR fortran/34319.
7 ! Check handling of "NAN(alphanum)"
9 character(len
=200) :: str
16 str
= 'INfinity' ; read(str
,*) r
17 if (r
< 0 .or
. r
/= r
*1.1) STOP 1
20 str
= '-INF' ; read(str
,*) r
21 if (r
> 0 .or
. r
/= r
*1.1) STOP 2
24 str
= '+INF' ; read(str
,*) r
25 if (r
< 0 .or
. r
/= r
*1.1) STOP 3
28 str
= '-inFiniTY' ; read(str
,*) r
29 if (r
> 0 .or
. r
/= r
*1.1) STOP 4
32 str
= 'NAN' ; read(str
,*) r
33 if (.not
. isnan(r
)) STOP 5
36 str
= '-NAN' ; read(str
,*) r
37 if (.not
. isnan(r
)) STOP 6
40 str
= '+NAN' ; read(str
,*) r
41 if (.not
. isnan(r
)) STOP 7
44 str
= 'NAN(0x111)' ; read(str
,*) r
45 if (.not
. isnan(r
)) STOP 8
48 str
= '-NAN(123)' ; read(str
,*) r
49 if (.not
. isnan(r
)) STOP 9
52 str
= '+NAN(0xFFE)' ; read(str
,*) r
53 if (.not
. isnan(r
)) STOP 10
59 str
= '(0.0,INfinity)' ; read(str
,*) z
60 if (aimag(z
) < 0 .or
. aimag(z
) /= aimag(z
)*1.1) STOP 11
63 str
= '(-INF,0.0)' ; read(str
,*) z
64 if (real(z
) > 0 .or
. real(z
) /= real(z
)*1.1) STOP 12
67 str
= '(0.0,+INF)' ; read(str
,*) z
68 if (aimag(z
) < 0 .or
. aimag(z
) /= aimag(z
)*1.1) STOP 13
71 str
= '(-inFiniTY,0.0)' ; read(str
,*) z
72 if (real(z
) > 0 .or
. real(z
) /= real(z
)*1.1) STOP 14
75 str
= '(NAN,0.0)' ; read(str
,*) z
76 if (.not
. isnan(real(z
))) STOP 15
79 str
= '(0.0,-NAN)' ; read(str
,*) z
80 if (.not
. isnan(aimag(z
))) STOP 16
83 str
= '(+NAN,0.0)' ; read(str
,*) z
84 if (.not
. isnan(real(z
))) STOP 17
87 str
= '(NAN(0x111),0.0)' ; read(str
,*) z
88 if (.not
. isnan(real(z
))) STOP 18
91 str
= '(0.0,-NaN(123))' ; read(str
,*) z
92 if (.not
. isnan(aimag(z
))) STOP 19
95 str
= '(+nan(0xFFE),0.0)' ; read(str
,*) z
96 if (.not
. isnan(real(z
))) STOP 20