| 1 |
! { dg-do run } |
| 2 |
! { dg-require-effective-target fortran_large_real } |
| 3 |
! PR 24174 and PR 24305 |
| 4 |
program large_real_kind_form_io_1 |
| 5 |
! This should be 10 on systems that support kind=10 |
| 6 |
integer, parameter :: k = selected_real_kind (precision (0.0_8) + 1) |
| 7 |
real(kind=k) :: a,b(2), c, eps |
| 8 |
complex(kind=k) :: d, e, f(2), g |
| 9 |
character(len=200) :: tmp |
| 10 |
! Test real(k) scalar and array formatted IO |
| 11 |
eps = 10 * spacing (2.0_k) ! 10 ulp precision is enough. |
| 12 |
b(:) = 2.0_k |
| 13 |
write (tmp, *) b |
| 14 |
read (tmp, *) a, c |
| 15 |
if (abs (a - b(1)) > eps) STOP 1 |
| 16 |
if (abs (c - b(2)) > eps) STOP 2 |
| 17 |
! Complex(k) scalar and array formatted and list formatted IO |
| 18 |
d = cmplx ( 1.0_k, 2.0_k, k) |
| 19 |
f = d |
| 20 |
write (tmp, *) f |
| 21 |
read (tmp, *) e, g |
| 22 |
if (abs (e - d) > eps) STOP 3 |
| 23 |
if (abs (g - d) > eps) STOP 4 |
| 24 |
write (tmp, '(2(e12.4e5, 2x))') d |
| 25 |
read (tmp, '(2(e12.4e5, 2x))') e |
| 26 |
if (abs (e - d) > eps) STOP 5 |
| 27 |
end program large_real_kind_form_io_1 |