Debian Codegraph @

gcc/testsuite/gfortran.dg/erf_2.F90

raw
1 ! { dg-options "-fno-range-check -ffree-line-length-none -O0" }
2 ! { dg-add-options ieee }
3 !
4 ! Check that simplification functions and runtime library agree on ERF,
5 ! ERFC and ERFC_SCALED.
6
7 program test
8 implicit none
9
10 interface check
11 procedure check_r4
12 procedure check_r8
13 end interface check
14
15 real(kind=4) :: x4
16 real(kind=8) :: x8
17
18 #define CHECK(a) \
19 x8 = a ; x4 = a ; \
20 call check(erf(real(a,kind=8)), erf(x8)) ; \
21 call check(erf(real(a,kind=4)), erf(x4)) ; \
22 call check(erfc(real(a,kind=8)), erfc(x8)) ; \
23 call check(erfc(real(a,kind=4)), erfc(x4)) ; \
24 call check(erfc_scaled(real(a,kind=8)), erfc_scaled(x8)) ; \
25 call check(erfc_scaled(real(a,kind=4)), erfc_scaled(x4)) ;
26
27 CHECK(0.0)
28 CHECK(0.9)
29 CHECK(1.9)
30 CHECK(19.)
31 CHECK(190.)
32
33 CHECK(-0.0)
34 CHECK(-0.9)
35 CHECK(-1.9)
36 CHECK(-19.)
37 CHECK(-190.)
38
39 contains
40
41 subroutine check_r4 (a, b)
42 real(kind=4), intent(in) :: a, b
43 if (abs(a - b) > 10 * spacing(a)) STOP 1
44 end subroutine
45
46 subroutine check_r8 (a, b)
47 real(kind=8), intent(in) :: a, b
48 if (abs(a - b) > 10 * spacing(a)) STOP 2
49 end subroutine
50
51 end program test