1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
! { dg-do run }
! { dg-options "-fno-range-check" }
!
! PR fortran/34342
!
! Test for Fortran 2003 BOZ.
!
program f2003
implicit none
real,parameter :: r2c = real(int(z'3333'))
real,parameter :: rc = real(z'50CB9F09')
double precision,parameter :: dc = dble(Z'3FD34413509F79FF')
complex,parameter :: z1c = cmplx(b'11000001010001101101110110000011', 3.049426e-10)
complex,parameter :: z2c = cmplx(4.160326e16, o'6503667306')
real :: r2 = real(int(z'3333'))
real :: r = real(z'50CB9F09')
double precision :: d = dble(Z'3FD34413509F79FF')
complex :: z1 = cmplx(b'11000001010001101101110110000011', 3.049426e-10)
complex :: z2 = cmplx(4.160326e16, o'6503667306')
if (r2c /= 13107.0) call abort()
if (rc /= 2.732958e10) call abort()
if (dc /= 0.30102999566398120d0) call abort()
if (real(z1c) /= -1.242908e1 .or. aimag(z1c) /= 3.049426e-10) call abort()
if (real(z2c) /= 4.160326e16 .or. aimag(z2c) /= 5.343285e-7) call abort()
if (r2 /= 13107.0) call abort()
if (r /= 2.732958e10) call abort()
if (d /= 0.30102999566398120d0) call abort()
if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort()
if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort()
r2 = dble(int(z'3333'))
r = real(z'50CB9F09')
d = dble(Z'3FD34413509F79FF')
z1 = cmplx(b'11000001010001101101110110000011', 3.049426e-10)
z2 = cmplx(4.160326e16, o'6503667306')
if (r2 /= 13107d0) call abort()
if (r /= 2.732958e10) call abort()
if (d /= 0.30102999566398120d0) call abort()
if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort()
if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort()
call test4()
call test8()
contains
subroutine test4
real,parameter :: r2c = real(int(z'3333', kind=4), kind=4)
real,parameter :: rc = real(z'50CB9F09', kind=4)
complex,parameter :: z1c = cmplx(b'11000001010001101101110110000011', 3.049426e-10, kind=4)
complex,parameter :: z2c = cmplx(4.160326e16, o'6503667306', kind=4)
real :: r2 = real(int(z'3333', kind=4), kind=4)
real :: r = real(z'50CB9F09', kind=4)
complex :: z1 = cmplx(b'11000001010001101101110110000011', 3.049426e-10, kind=4)
complex :: z2 = cmplx(4.160326e16, o'6503667306', kind=4)
if (r2c /= 13107.0) call abort()
if (rc /= 2.732958e10) call abort()
if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort()
if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort()
if (r2 /= 13107.0) call abort()
if (r /= 2.732958e10) call abort()
if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort()
if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort()
r2 = real(int(z'3333'), kind=4)
r = real(z'50CB9F09', kind=4)
z1 = cmplx(b'11000001010001101101110110000011', 3.049426e-10, kind=4)
z2 = cmplx(4.160326e16, o'6503667306', kind=4)
if (r2 /= 13107.0) call abort()
if (r /= 2.732958e10) call abort()
if (real(z1) /= -1.242908e1 .or. aimag(z1) /= 3.049426e-10) call abort()
if (real(z2) /= 4.160326e16 .or. aimag(z2) /= 5.343285e-7) call abort()
end subroutine test4
subroutine test8
real(8),parameter :: r2c = real(int(z'FFFFFF3333', kind=8), kind=8)
real(8),parameter :: rc = real(z'AAAAAFFFFFFF3333', kind=8)
complex(8),parameter :: z1c = cmplx(b'11111011111111111111111111111111111111111111111111111111110101',-4.0, kind=8)
complex(8),parameter :: z2c = cmplx(5.0, o'442222222222233301245', kind=8)
real(8) :: r2 = real(int(z'FFFFFF3333',kind=8),kind=8)
real(8) :: r = real(z'AAAAAFFFFFFF3333', kind=8)
complex(8) :: z1 = cmplx(b'11111011111111111111111111111111111111111111111111111111110101',-4.0, kind=8)
complex(8) :: z2 = cmplx(5.0, o'442222222222233301245', kind=8)
if (r2c /= 1099511575347.0d0) call abort()
if (rc /= -3.72356884822177915d-103) call abort()
if (real(z1c) /= 3.05175781249999627d-5 .or. aimag(z1c) /= -4.0) call abort()
if (real(z2c) /= 5.0 .or. aimag(z2c) /= 3.98227593015308981d41) call abort()
if (r2 /= 1099511575347.0d0) call abort()
if (r /= -3.72356884822177915d-103) call abort()
if (real(z1) /= 3.05175781249999627d-5 .or. aimag(z1) /= -4.0) call abort()
if (real(z2) /= 5.0 .or. aimag(z2) /= 3.98227593015308981d41) call abort()
r2 = real(int(z'FFFFFF3333',kind=8),kind=8)
r = real(z'AAAAAFFFFFFF3333', kind=8)
z1 = cmplx(b'11111011111111111111111111111111111111111111111111111111110101',-4.0, kind=8)
z2 = cmplx(5.0, o'442222222222233301245', kind=8)
if (r2 /= 1099511575347.0d0) call abort()
if (r /= -3.72356884822177915d-103) call abort()
if (real(z1) /= 3.05175781249999627d-5 .or. aimag(z1) /= -4.0) call abort()
if (real(z2) /= 5.0 .or. aimag(z2) /= 3.98227593015308981d41) call abort()
end subroutine test8
end program f2003
|