summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/large_real_kind_2.F90
blob: 2e3891b2ffd16fa9c84ce2837f2a7f0233fe7bc8 (plain)
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
! { dg-do run }
! { dg-require-effective-target fortran_large_real }
! { dg-xfail-if "" { "*-*-freebsd*" } { "*" }  { "" } }

! Testing library calls on large real kinds (larger than kind=8)
  implicit none

  integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
  real(8),parameter :: eps = 1e-8

  real(kind=k) :: x, x1
  real(8) :: y, y1
  complex(kind=k) :: z, z1
  complex(8) :: w, w1

#define TEST_FUNCTION(func,val) \
 x = val ;\
 y = x ;\
 x = func (x) ;\
 y = func (y) ;\
 if (abs((y - x) / y) > eps) call abort
  
#define CTEST_FUNCTION(func,valc) \
 z = valc ;\
 w = z ;\
 z = func (z) ;\
 w = func (w) ;\
 if (abs((z - w) / w) > eps) call abort

 TEST_FUNCTION(cos,17.456)
 TEST_FUNCTION(sin,17.456)
 TEST_FUNCTION(tan,1.456)
 TEST_FUNCTION(cosh,-2.45)
 TEST_FUNCTION(sinh,7.1)
 TEST_FUNCTION(tanh,12.7)
 TEST_FUNCTION(acos,0.78)
 TEST_FUNCTION(asin,-0.24)
 TEST_FUNCTION(atan,-17.123)
 TEST_FUNCTION(acosh,0.2)
 TEST_FUNCTION(asinh,0.3)
 TEST_FUNCTION(atanh,0.4)
 TEST_FUNCTION(exp,1.74)
 TEST_FUNCTION(log,0.00178914)
 TEST_FUNCTION(log10,123789.123)
 TEST_FUNCTION(sqrt,789.1356)

 CTEST_FUNCTION(cos,(17.456,-1.123))
 CTEST_FUNCTION(sin,(17.456,-7.6))
 CTEST_FUNCTION(exp,(1.74,-1.01))
 CTEST_FUNCTION(log,(0.00178914,-1.207))
 CTEST_FUNCTION(sqrt,(789.1356,2.4))

#define TEST_POWER(val1,val2) \
 x = val1 ; \
 y = x ; \
 x1 = val2 ; \
 y1 = x1; \
 if (abs((x**x1 - y**y1)/(y**y1)) > eps) call abort
 
#define CTEST_POWER(val1,val2) \
 z = val1 ; \
 w = z ; \
 z1 = val2 ; \
 w1 = z1; \
 if (abs((z**z1 - w**w1)/(w**w1)) > eps) call abort

 CTEST_POWER (1.0,1.0)
 CTEST_POWER (1.0,5.4)
 CTEST_POWER (1.0,-5.4)
 CTEST_POWER (1.0,0.0)
 CTEST_POWER (-1.0,1.0)
 CTEST_POWER (-1.0,5.4)
 CTEST_POWER (-1.0,-5.4)
 CTEST_POWER (-1.0,0.0)
 CTEST_POWER (0.0,1.0)
 CTEST_POWER (0.0,5.4)
 CTEST_POWER (0.0,-5.4)
 CTEST_POWER (0.0,0.0)
 CTEST_POWER (7.6,1.0)
 CTEST_POWER (7.6,5.4)
 CTEST_POWER (7.6,-5.4)
 CTEST_POWER (7.6,0.0)
 CTEST_POWER (-7.6,1.0)
 CTEST_POWER (-7.6,5.4)
 CTEST_POWER (-7.6,-5.4)
 CTEST_POWER (-7.6,0.0)

 CTEST_POWER ((10.78,123.213),(14.123,13279.5))
 CTEST_POWER ((-10.78,123.213),(14.123,13279.5))
 CTEST_POWER ((10.78,-123.213),(14.123,13279.5))
 CTEST_POWER ((10.78,123.213),(-14.123,13279.5))
 CTEST_POWER ((10.78,123.213),(14.123,-13279.5))
 CTEST_POWER ((-10.78,-123.213),(14.123,13279.5))
 CTEST_POWER ((-10.78,123.213),(-14.123,13279.5))
 CTEST_POWER ((-10.78,123.213),(14.123,-13279.5))
 CTEST_POWER ((10.78,-123.213),(-14.123,13279.5))
 CTEST_POWER ((10.78,-123.213),(14.123,-13279.5))
 CTEST_POWER ((10.78,123.213),(-14.123,-13279.5))
 CTEST_POWER ((-10.78,-123.213),(-14.123,13279.5))
 CTEST_POWER ((-10.78,-123.213),(14.123,-13279.5))
 CTEST_POWER ((-10.78,123.213),(-14.123,-13279.5))
 CTEST_POWER ((10.78,-123.213),(-14.123,-13279.5))
 CTEST_POWER ((-10.78,-123.213),(-14.123,-13279.5))
 
end