OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.fortran-torture/] [execute/] [power.f90] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
! Program to test the power (**) operator
2
program testpow
3
   implicit none
4
   real(kind=4) r, s, two
5
   real(kind=8) :: q
6
   complex(kind=4) :: c, z
7
   real, parameter :: del = 0.0001
8
   integer i, j
9
 
10
   i = 2
11
   j = i ** 10
12
   if (abs (j - 1024) .gt. del) call abort
13
   j = i ** (-10)
14
   if (abs (j - 0) .gt. del) call abort
15
   j = i ** 0
16
   if (abs (j - 1) .gt. del) call abort
17
   i = 1
18
   j = i ** 10
19
   if (abs (j - 1) .gt. del) call abort
20
   j = i ** (-10)
21
   if (abs (j - 1) .gt. del) call abort
22
   j = i ** 0
23
   if (abs (j - 1) .gt. del) call abort
24
   i = -1
25
   j = i ** 10
26
   if (abs (j - 1) .gt. del) call abort
27
   j = i ** (-10)
28
   if (abs (j - 1) .gt. del) call abort
29
   j = i ** 0
30
   if (abs (j - 1) .gt. del) call abort
31
   j = i ** 11
32
   if (abs (j - (-1)) .gt. del) call abort
33
   j = i ** (-11)
34
   if (abs (j - (-1)) .gt. del) call abort
35
 
36
   c = (2.0, 3.0)
37
   z = c ** 2
38
   if (abs(z - (-5.0, 12.0)) .gt. del) call abort
39
   z = c ** 7
40
   if (abs(z - (6554.0, 4449.0)) .gt. del) call abort
41
 
42
   two = 2.0
43
 
44
   r = two ** 1
45
   if (abs (r - 2.0) .gt. del) call abort
46
   r = two ** 2
47
   if (abs (r - 4.0) .gt. del) call abort
48
   r = two ** 3
49
   if (abs (r - 8.0) .gt. del) call abort
50
   r = two ** 4
51
   if (abs (r - 16.0) .gt. del) call abort
52
   r = two ** 0
53
   if (abs (r - 1.0) .gt. del) call abort
54
   r = two ** (-1)
55
   if (abs (r - 0.5) .gt. del) call abort
56
   r = two ** (-2)
57
   if (abs (r - 0.25) .gt. del) call abort
58
   r = two ** (-4)
59
   if (abs (r - 0.0625) .gt. del) call abort
60
   s = 3.0
61
   r = two ** s
62
   if (abs (r - 8.0) .gt. del) call abort
63
   s = -3.0
64
   r = two ** s
65
   if (abs (r - 0.125) .gt. del) call abort
66
   i = 3
67
   r = two ** i
68
   if (abs (r - 8.0) .gt. del) call abort
69
   i = -3
70
   r = two ** i
71
   if (abs (r - 0.125) .gt. del) call abort
72
   c = (2.0, 3.0)
73
   c = c ** two
74
   if (abs(c - (-5.0, 12.0)) .gt. del) call abort
75
end program

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.