Debian Codegraph @

gcc/testsuite/gfortran.dg/dec_math_5.f90

raw
1 ! { dg-do run }
2 ! { dg-additional-options "-std=gnu" }
3 ! { dg-require-effective-target fortran_real_10 }
4 ! { dg-require-effective-target fortran_real_16 }
5
6 program p
7 implicit none
8 integer, parameter :: ep = selected_real_kind (17) ! real(10)
9 real(4) :: a1, e1 = 1.e-5
10 real(8) :: b1, e2 = 1.e-14
11 real(ep) :: c1, e3 = 1.e-17
12 real(16) :: d1, e4 = 1.e-30
13
14 a1 = 1; a1 = atand(a1)
15 b1 = 1; b1 = atand(b1)
16 c1 = 1; c1 = atand(c1)
17 d1 = 1; d1 = atand(d1)
18 ! print '(4(F15.11))', a1, b1, c1, d1
19 if (abs(a1 - 45) > e1) stop 1
20 if (abs(b1 - 45) > e2) stop 2
21 if (abs(c1 - 45) > e3) stop 3
22 if (abs(d1 - 45) > e4) stop 4
23
24 a1 = 0.5; a1 = asind(a1)
25 b1 = 0.5; b1 = asind(b1)
26 c1 = 0.5; c1 = asind(c1)
27 d1 = 0.5; d1 = asind(d1)
28 if (abs(a1 - 30) > e1) stop 5
29 if (abs(b1 - 30) > e2) stop 6
30 if (abs(c1 - 30) > e3) stop 7
31 if (abs(d1 - 30) > e4) stop 8
32
33 a1 = 0.5; a1 = acosd(a1)
34 b1 = 0.5; b1 = acosd(b1)
35 c1 = 0.5; c1 = acosd(c1)
36 d1 = 0.5; d1 = acosd(d1)
37 if (abs(a1 - 60) > e1) stop 9
38 if (abs(b1 - 60) > e2) stop 10
39 if (abs(c1 - 60) > e3) stop 11
40 if (abs(d1 - 60) > e4) stop 12
41
42 a1 = 45; a1 = tand(a1)
43 b1 = 45; b1 = tand(b1)
44 c1 = 45; c1 = tand(c1)
45 d1 = 45; d1 = tand(d1)
46 if (abs(a1 - 1) > e1) stop 13
47 if (abs(b1 - 1) > e2) stop 14
48 if (abs(c1 - 1) > e3) stop 15
49 if (abs(d1 - 1) > e4) stop 16
50
51 a1 = 60; a1 = tand(a1)
52 b1 = 60; b1 = tand(b1)
53 c1 = 60; c1 = tand(c1)
54 d1 = 60; d1 = tand(d1)
55 if (abs(a1 - sqrt (3._4) ) > e1) stop 17
56 if (abs(b1 - sqrt (3._8) ) > e2) stop 18
57 if (abs(c1 - sqrt (3._ep)) > e3) stop 19
58 if (abs(d1 - sqrt (3._16)) > e4) stop 20
59
60 a1 = 45; a1 = cotand(a1)
61 b1 = 45; b1 = cotand(b1)
62 c1 = 45; c1 = cotand(c1)
63 d1 = 45; d1 = cotand(d1)
64 if (abs(a1 - 1) > e1) stop 21
65 if (abs(b1 - 1) > e2) stop 22
66 if (abs(c1 - 1) > e3) stop 23
67 if (abs(d1 - 1) > e4) stop 24
68
69 a1 = 30; a1 = cotand(a1)
70 b1 = 30; b1 = cotand(b1)
71 c1 = 30; c1 = cotand(c1)
72 d1 = 30; d1 = cotand(d1)
73 if (abs(a1 - sqrt (3._4) ) > e1) stop 25
74 if (abs(b1 - sqrt (3._8) ) > e2) stop 26
75 if (abs(c1 - sqrt (3._ep)) > e3) stop 27
76 if (abs(d1 - sqrt (3._16)) > e4) stop 28
77
78 a1 = 1; a1 = atan2d(a1, a1)
79 b1 = 1; b1 = atan2d(b1, b1)
80 c1 = 1; c1 = atan2d(c1, c1)
81 d1 = 1; d1 = atan2d(d1, d1)
82 if (abs(a1 - 45) > e1) stop 29
83 if (abs(b1 - 45) > e2) stop 30
84 if (abs(c1 - 45) > e3) stop 31
85 if (abs(d1 - 45) > e4) stop 32
86
87 a1 = 30; a1 = sind(a1)
88 b1 = 30; b1 = sind(b1)
89 c1 = 30; c1 = sind(c1)
90 d1 = 30; d1 = sind(d1)
91 if (abs(a1 - 0.5) > e1) stop 33
92 if (abs(b1 - 0.5) > e2) stop 34
93 if (abs(c1 - 0.5) > e3) stop 35
94 if (abs(d1 - 0.5) > e4) stop 36
95
96 a1 = 60; a1 = cosd(a1)
97 b1 = 60; b1 = cosd(b1)
98 c1 = 60; c1 = cosd(c1)
99 d1 = 60; d1 = cosd(d1)
100 if (abs(a1 - 0.5) > e1) stop 37
101 if (abs(b1 - 0.5) > e2) stop 38
102 if (abs(c1 - 0.5) > e3) stop 39
103 if (abs(d1 - 0.5) > e4) stop 40
104 end program p