Debian Codegraph @

gcc/testsuite/gfortran.dg/erf_3.F90

raw
1 ! { dg-options "-fno-range-check -ffree-line-length-none -O0" }
2 ! { dg-add-options ieee }
3 ! { dg-skip-if "PR libfortran/59313" { hppa*-*-hpux* } }
4 !
5 ! Check that simplification functions and runtime library agree on ERF,
6 ! ERFC and ERFC_SCALED, for quadruple-precision.
7 !
8
9 program test
10 use, intrinsic :: iso_fortran_env
11 implicit none
12
13 ! QP will be the largest supported real kind, possibly real(kind=16)
14 integer, parameter :: qp = real_kinds(ubound(real_kinds,dim=1))
15 real(kind=qp) :: x
16
17 #define CHECK(a) \
18 x = a ; \
19 call check(erf(real(a,kind=qp)), erf(x)) ; \
20 call check(erfc(real(a,kind=qp)), erfc(x)) ; \
21 call check(erfc_scaled(real(a,kind=qp)), erfc_scaled(x))
22
23 CHECK(0.0)
24 CHECK(0.9)
25 CHECK(1.9)
26 CHECK(10.)
27 CHECK(11.)
28 CHECK(12.)
29 CHECK(13.)
30 CHECK(14.)
31 CHECK(49.)
32 CHECK(190.)
33
34 CHECK(-0.0)
35 CHECK(-0.9)
36 CHECK(-1.9)
37 CHECK(-19.)
38 CHECK(-190.)
39
40 contains
41
42 subroutine check (a, b)
43 real(kind=qp), intent(in) :: a, b
44 print *, abs(a-b) / spacing(a)
45 if (abs(a - b) > 10 * spacing(a)) STOP 1
46 end subroutine
47
48 end program test