fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / erf_2.F90
blob087dfd38e19ba094b4902ab4d3a44e388956a8c7
1 ! { dg-do run }
2 ! { dg-options "-fno-range-check -ffree-line-length-none " }
3 ! { dg-add-options ieee }
5 ! Check that simplification functions and runtime library agree on ERF,
6 ! ERFC and ERFC_SCALED.
8 program test
9   implicit none
11   interface check
12     procedure check_r4
13     procedure check_r8
14   end interface check
16   real(kind=4) :: x4
17   real(kind=8) :: x8
19 #define CHECK(a) \
20   x8 = a ; x4 = a ; \
21   call check(erf(real(a,kind=8)), erf(x8)) ; \
22   call check(erf(real(a,kind=4)), erf(x4)) ; \
23   call check(erfc(real(a,kind=8)), erfc(x8)) ; \
24   call check(erfc(real(a,kind=4)), erfc(x4)) ; \
25   call check(erfc_scaled(real(a,kind=8)), erfc_scaled(x8)) ; \
26   call check(erfc_scaled(real(a,kind=4)), erfc_scaled(x4)) ;
28   CHECK(0.0)
29   CHECK(0.9)
30   CHECK(1.9)
31   CHECK(19.)
32   CHECK(190.)
34   CHECK(-0.0)
35   CHECK(-0.9)
36   CHECK(-1.9)
37   CHECK(-19.)
38   CHECK(-190.)
40 contains
42   subroutine check_r4 (a, b)
43     real(kind=4), intent(in) :: a, b
44     if (abs(a - b) > 10 * spacing(a)) call abort
45   end subroutine
47   subroutine check_r8 (a, b)
48     real(kind=8), intent(in) :: a, b
49     if (abs(a - b) > 10 * spacing(a)) call abort
50   end subroutine
52 end program test