diff mbox

[Fortran,testsuite] Increase tolerance level for precision of bessel function.

Message ID 5357BE05.2080701@arm.com
State New
Headers show

Commit Message

Tejas Belagod April 23, 2014, 1:20 p.m. UTC
Hi,

The attached patch adjusts a fortran test to decrease the precision of one of 
the points on the bessel curve.
gfortran.dg/bessel_7.f90 fails for a value 3.0 because libm does not seem to be 
accurate enough compared to what the test expects.

I did a like-for-like run on x86 vs aarch64. The issue seems to be in the level 
of precision that this test checks for. At the fail point, though the two values 
being compared are comparable, they aren't equal.

On aarch64, it looks like this:

33 -0.138861489E+30 -0.138861319E+30   -0.17E+24 10.2699956894  T  T
34 -0.304842886E+31 -0.304842493E+31   -0.39E+25 10.8117713928  T  T
35 -0.689588648E+32 -0.689587681E+32   -0.97E+26 11.7649326324  T  T
36 -0.160599184E+34 -0.160598952E+34   -0.23E+28 12.1240425110  T  F

If you see row #36, the 2nd and 3rd column values are comparable, but not equal. 
The delta is indicated in the 5th column which is greater that what the test 
expects -  12 ULPs.

On x86 it looks like this:

33 -0.138861508E+30 -0.138861366E+30   -0.14E+24  8.5583286285  T  T
34 -0.304842916E+31 -0.304842614E+31   -0.30E+25  8.3167467117  T  T
35 -0.689588696E+32 -0.689587971E+32   -0.73E+26  8.8236989975  T  T
36 -0.160599184E+34 -0.160599029E+34   -0.15E+28  8.0826950073  T  T

The delta on aarch64 is more than x86. If we increase the tolerance level for 
precision as shown in the patch, the test works fine for both x86 and aarch64.

Tested on aarch64-none-linux-gnu, x86_64-unknown-linux-gnu.

OK for trunk?

Thanks,
Tejas.

Changelog:

2014-04-23  Tejas Belagod  <tejas.belagod@arm.com>

testsuite/

	* gfortran.dg/bessel_7.f90(myeps): Increase precision tolerance level.
diff mbox

Patch

diff --git a/gcc/testsuite/gfortran.dg/bessel_7.f90 b/gcc/testsuite/gfortran.dg/bessel_7.f90
index 7e63ed1..c6b5f74 100644
--- a/gcc/testsuite/gfortran.dg/bessel_7.f90
+++ b/gcc/testsuite/gfortran.dg/bessel_7.f90
@@ -16,7 +16,7 @@ 
 implicit none
 real,parameter :: values(*) = [0.0, 0.5, 1.0, 0.9, 1.8,2.0,3.0,4.0,4.25,8.0,34.53, 475.78] 
 real,parameter :: myeps(size(values)) = epsilon(0.0) &
-                  * [2, 3, 4, 5, 8, 2, 12, 6, 7, 6, 36, 168 ]
+                  * [2, 3, 4, 5, 8, 2, 13, 6, 7, 6, 36, 168 ]
 ! The following is sufficient for me - the values above are a bit
 ! more tolerant
 !                  * [0, 0, 0, 3, 3, 0, 9, 0, 2, 1, 22, 130 ]