2 ! These we failing on targets which do not provide the c99 complex math
4 ! Extracted from intrinsic77.f in the g77 testsuite.
11 subroutine square_root
12 intrinsic sqrt
, dsqrt
, csqrt
16 call c_r(SQRT(x
),a
,'SQRT(real)')
17 call c_d(SQRT(1.d0
*x
),1.d0
*a
,'SQRT(double)')
18 call c_c(SQRT((1.,0.)*x
),(1.,0.)*a
,'SQRT(complex)')
19 call c_d(DSQRT(1.d0
*x
),1.d0
*a
,'DSQRT(double)')
20 call c_c(CSQRT((1.,0.)*x
),(1.,0.)*a
,'CSQRT(complex)')
21 call p_r_r(SQRT
,x
,a
,'SQRT')
22 call p_d_d(DSQRT
,1.d0
*x
,1.d0
*a
,'DSQRT')
23 call p_c_c(CSQRT
,(1.,0.)*x
,(1.,0.)*a
,'CSQRT')
25 subroutine failure(label
)
26 ! Report failure and set flag
30 write(6,'(a,a,a)') 'Test ',label
,' FAILED'
33 subroutine c_r(a
,b
,label
)
34 ! Check if REAL a equals b, and fail otherwise
37 if ( abs(a
-b
) .gt
. 1.0e-5 ) then
39 write(6,*) 'Got ',a
,' expected ', b
42 subroutine c_d(a
,b
,label
)
43 ! Check if DOUBLE PRECISION a equals b, and fail otherwise
46 if ( abs(a
-b
) .gt
. 1.0d-5 ) then
48 write(6,*) 'Got ',a
,' expected ', b
52 subroutine c_c(a
,b
,label
)
53 ! Check if COMPLEX a equals b, and fail otherwise
56 if ( abs(a
-b
) .gt
. 1.0e-5 ) then
58 write(6,*) 'Got ',a
,' expected ', b
61 subroutine p_r_r(f
,x
,a
,label
)
62 ! Check if REAL f(x) equals a for REAL x
65 call c_r(f(x
),a
,label
)
67 subroutine p_d_d(f
,x
,a
,label
)
68 ! Check if DOUBLE PRECISION f(x) equals a for DOUBLE PRECISION x
69 double precision f
,x
,a
71 call c_d(f(x
),a
,label
)
73 subroutine p_c_c(f
,x
,a
,label
)
74 ! Check if COMPLEX f(x) equals a for COMPLEX x
77 call c_c(f(x
),a
,label
)