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/] [cmplx.f90] - Blame information for rev 149

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

Line No. Rev Author Line
1 149 jeremybenn
! Test complex munbers
2
program testcmplx
3
   implicit none
4
   complex(kind=4) c, d
5
   complex(kind=8) z
6
   real(kind=4) x, y
7
   real(kind=8) q
8
 
9
   ! cmplx intrinsic
10
   x = 3
11
   y = 4
12
   c = cmplx(x,y)
13
   if (c .ne. (3.0, 4.0)) call abort
14
   x = 4
15
   y = 3
16
   z = cmplx(x, y, 8)
17
   if (z .ne. (4.0, 3.0)) call abort
18
   z = c
19
   if (z .ne. (3.0, 4.0)) call abort
20
 
21
   ! dcmplx intrinsic
22
   x = 3
23
   y = 4
24
   z = dcmplx (x, y)
25
   if (z .ne. (3.0, 4.0)) call abort
26
 
27
   ! conjucates and aimag
28
   c = (1.0, 2.0)
29
   c = conjg (c)
30
   x = aimag (c)
31
   if (abs (c - (1.0, -2.0)) .gt. 0.001) call abort
32
   if (x .ne. -2.0) call abort
33
   z = (2.0, 1.0)
34
   z = conjg (z)
35
   q = aimag (z)
36
   if (z .ne. (2.0, -1.0)) call abort
37
   if (q .ne. -1.0) call abort
38
 
39
   ! addition, subtraction and multiplication
40
   c = (1, 3)
41
   d = (5, 2)
42
   if (c + d .ne. ( 6, 5)) call abort
43
   if (c - d .ne. (-4, 1)) call abort
44
   if (c * d .ne. (-1, 17)) call abort
45
 
46
   ! test for constant folding
47
   if ((35.,-10.)**0.NE.(1.,0.)) call abort
48
end program

powered by: WebSVN 2.1.0

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