This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch for math/libm-test.inc and sysdeps/ieee754/ldbl-96


Since testing for existence of function may cause exceptions, I clear
all exceptions in init_max_error. Or we can modify all those functions
to set and check errno for ENOSYS before continue. 

Together with my previous ia64 patch for long double header files,
"make check" passes on ia64 now.

H.J.
----
2000-09-30 H.J. Lu  <hjl@gnu.org>

	* sysdeps/ieee754/ldbl-96/s_ceill.c (__ceill): Handle overflow.
	* sysdeps/ieee754/ldbl-96/s_floorl.c (__floorl): Likewise.

2000-09-29  H.J. Lu  <hjl@gnu.org>

	* math/libm-test.inc (init_max_error): Clear all exceptions
	before starting test.
	(acosh_test): Test for existence of function.
	(asinh_test): Likewise.
	(atan2_test): Likewise.
	(cabs_test): Likewise.
	(cacos_test): Likewise.
	(cacosh_test): Likewise.
	(casin_test): Likewise.
	(casinh_test): Likewise.
	(catan_test): Likewise.
	(catanh_test): Likewise.
	(ccos_test): Likewise.
	(ccosh_test): Likewise.
	(cexp_test): Likewise.
	(clog_test): Likewise.
	(clog10_test): Likewise.
	(cosh_test): Likewise.
	(cpow_test): Likewise.
	(csin_test): Likewise.
	(csinh_test): Likewise.
	(csqrt_test): Likewise.
	(ctan_test): Likewise.
	(ctanh_test): Likewise.
	(fmod_test): Likewise.
	(hypot_test): Likewise.
	(remainder_test): Likewise.
	(remquo_test): Likewise.
	(sincos_test): Likewise.
	(sinh_test): Likewise.
	(tanh_test): Likewise.

Index: sysdeps/ieee754/ldbl-96/s_ceill.c
===================================================================
RCS file: /work/cvs/gnu/glibc/sysdeps/ieee754/ldbl-96/s_ceill.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 s_ceill.c
--- sysdeps/ieee754/ldbl-96/s_ceill.c	2000/05/21 21:11:36	1.1.1.1
+++ sysdeps/ieee754/ldbl-96/s_ceill.c	2000/09/30 07:11:14
@@ -59,8 +59,13 @@ static long double huge = 1.0e4930;
 		if(((i0&i)|i1)==0) return x; /* x is integral */
 		if(huge+x>0.0) {	/* raise inexact flag */
 		    if(sx==0) {
-			if (j0>0) i0 += (0x80000000)>>j0;
-			else ++se;
+			if (j0>0 && (i0+(0x80000000>>j0))>i0)
+			  i0+=0x80000000>>j0;
+			else
+			  {
+			    i = 0x7fffffff;
+			    ++se;
+			  }
 		    }
 		    i0 &= (~i); i1=0;
 		}
Index: sysdeps/ieee754/ldbl-96/s_floorl.c
===================================================================
RCS file: /work/cvs/gnu/glibc/sysdeps/ieee754/ldbl-96/s_floorl.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 s_floorl.c
--- sysdeps/ieee754/ldbl-96/s_floorl.c	2000/05/21 21:11:36	1.1.1.1
+++ sysdeps/ieee754/ldbl-96/s_floorl.c	2000/09/30 07:11:59
@@ -60,8 +60,13 @@ static long double huge = 1.0e4930;
 		if(((i0&i)|i1)==0) return x; /* x is integral */
 		if(huge+x>0.0) {	/* raise inexact flag */
 		    if(sx) {
-			if (j0>0) i0 += (0x80000000)>>j0;
-			else ++se;
+			if (j0>0 && (i0+(0x80000000>>j0))>i0)
+			  i0 += (0x80000000)>>j0;
+			else
+			  {
+			    i = 0x7fffffff;
+			    ++se;
+			  }
 		    }
 		    i0 &= (~i); i1=0;
 		}
Index: math/libm-test.inc
===================================================================
RCS file: /work/cvs/gnu/glibc/math/libm-test.inc,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 libm-test.inc
--- math/libm-test.inc	2000/09/26 00:29:07	1.1.1.3
+++ math/libm-test.inc	2000/09/30 01:18:21
@@ -189,6 +189,7 @@ init_max_error (void)
   max_error = 0;
   real_max_error = 0;
   imag_max_error = 0;
+  feclearexcept (FE_ALL_EXCEPT);
 }
 
 static void
@@ -723,6 +724,12 @@ acos_test (void)
 static void
 acosh_test (void)
 {
+  errno = 0;
+  FUNC(acosh) (7);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (acosh);
 
   TEST_f_f (acosh, plus_infty, plus_infty);
@@ -770,6 +777,12 @@ asin_test (void)
 static void
 asinh_test (void)
 {
+  errno = 0;
+  FUNC(asinh) (0.7);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (asinh);
 
   TEST_f_f (asinh, 0, 0);
@@ -815,6 +828,11 @@ atan_test (void)
 static void
 atanh_test (void)
 {
+  errno = 0;
+  FUNC(atanh) (0.7);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
 
   START (atanh);
 
@@ -838,6 +856,12 @@ atanh_test (void)
 static void
 atan2_test (void)
 {
+  errno = 0;
+  FUNC(atan2) (-0, 1);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (atan2);
 
   /* atan2 (0,x) == 0 for x > 0.  */
@@ -904,6 +928,12 @@ atan2_test (void)
 static void
 cabs_test (void)
 {
+  errno = 0;
+  FUNC(cabs) (BUILD_COMPLEX (0.7, 12.4));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (cabs);
 
   /* cabs (x + iy) is specified as hypot (x,y) */
@@ -944,6 +974,12 @@ cabs_test (void)
 static void
 cacos_test (void)
 {
+  errno = 0;
+  FUNC(cacos) (BUILD_COMPLEX (0.7, 1.2));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (cacos);
 
 
@@ -1002,6 +1038,12 @@ cacos_test (void)
 static void
 cacosh_test (void)
 {
+  errno = 0;
+  FUNC(cacosh) (BUILD_COMPLEX (0.7, 1.2));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (cacosh);
 
 
@@ -1125,6 +1167,12 @@ carg_test (void)
 static void
 casin_test (void)
 {
+  errno = 0;
+  FUNC(casin) (BUILD_COMPLEX (0.7, 1.2));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (casin);
 
   TEST_c_c (casin, 0, 0, 0.0, 0.0);
@@ -1183,6 +1231,12 @@ casin_test (void)
 static void
 casinh_test (void)
 {
+  errno = 0;
+  FUNC(casinh) (BUILD_COMPLEX (0.7, 1.2));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (casinh);
 
   TEST_c_c (casinh, 0, 0, 0.0, 0.0);
@@ -1241,6 +1295,12 @@ casinh_test (void)
 static void
 catan_test (void)
 {
+  errno = 0;
+  FUNC(catan) (BUILD_COMPLEX (0.7, 1.2));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (catan);
 
   TEST_c_c (catan, 0, 0, 0, 0);
@@ -1303,6 +1363,12 @@ catan_test (void)
 static void
 catanh_test (void)
 {
+  errno = 0;
+  FUNC(catanh) (BUILD_COMPLEX (0.7, 1.2));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (catanh);
 
   TEST_c_c (catanh, 0, 0, 0.0, 0.0);
@@ -1384,6 +1450,11 @@ cbrt_test (void)
 static void
 ccos_test (void)
 {
+  errno = 0;
+  FUNC(ccos) (BUILD_COMPLEX (0, 0));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
 
   START (ccos);
 
@@ -1448,6 +1519,11 @@ ccos_test (void)
 static void
 ccosh_test (void)
 {
+  errno = 0;
+  FUNC(ccosh) (BUILD_COMPLEX (0.7, 1.2));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
 
   START (ccosh);
 
@@ -1530,6 +1606,12 @@ ceil_test (void)
 static void
 cexp_test (void)
 {
+  errno = 0;
+  FUNC(cexp) (BUILD_COMPLEX (0, 0));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (cexp);
 
   TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0);
@@ -1602,6 +1684,12 @@ cimag_test (void)
 static void
 clog_test (void)
 {
+  errno = 0;
+  FUNC(clog) (BUILD_COMPLEX (-2, -3));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (clog);
 
   TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
@@ -1661,6 +1749,12 @@ clog_test (void)
 static void
 clog10_test (void)
 {
+  errno = 0;
+  FUNC(clog10) (BUILD_COMPLEX (0.7, 1.2));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (clog10);
 
   TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION);
@@ -1791,6 +1885,12 @@ cos_test (void)
 static void
 cosh_test (void)
 {
+  errno = 0;
+  FUNC(cosh) (0.7);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (cosh);
   TEST_f_f (cosh, 0, 1);
   TEST_f_f (cosh, minus_zero, 1);
@@ -1809,6 +1909,12 @@ cosh_test (void)
 static void
 cpow_test (void)
 {
+  errno = 0;
+  FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (cpow);
 
   TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0);
@@ -1862,6 +1968,11 @@ creal_test (void)
 static void
 csin_test (void)
 {
+  errno = 0;
+  FUNC(csin) (BUILD_COMPLEX (0.7, 1.2));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
 
   START (csin);
 
@@ -1926,6 +2037,11 @@ csin_test (void)
 static void
 csinh_test (void)
 {
+  errno = 0;
+  FUNC(csinh) (BUILD_COMPLEX (0.7, 1.2));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
 
   START (csinh);
 
@@ -1988,6 +2104,12 @@ csinh_test (void)
 static void
 csqrt_test (void)
 {
+  errno = 0;
+  FUNC(csqrt) (BUILD_COMPLEX (-1, 0));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (csqrt);
 
   TEST_c_c (csqrt, 0, 0, 0.0, 0.0);
@@ -2048,6 +2170,12 @@ csqrt_test (void)
 static void
 ctan_test (void)
 {
+  errno = 0;
+  FUNC(ctan) (BUILD_COMPLEX (0.7, 1.2));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (ctan);
 
   TEST_c_c (ctan, 0, 0, 0.0, 0.0);
@@ -2100,6 +2228,12 @@ ctan_test (void)
 static void
 ctanh_test (void)
 {
+  errno = 0;
+  FUNC(ctanh) (BUILD_COMPLEX (0, 0));
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (ctanh);
 
   TEST_c_c (ctanh, 0, 0, 0.0, 0.0);
@@ -2485,6 +2619,12 @@ fmin_test (void)
 static void
 fmod_test (void)
 {
+  errno = 0;
+  FUNC(fmod) (6.5, 2.3);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (fmod);
 
   /* fmod (+0, y) == +0 for y != 0.  */
@@ -2585,6 +2725,12 @@ gamma_test (void)
 static void
 hypot_test (void)
 {
+  errno = 0;
+  FUNC(hypot) (0.7, 12.4);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (hypot);
 
   TEST_ff_f (hypot, plus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN);
@@ -3399,6 +3545,11 @@ pow_test (void)
 static void
 remainder_test (void)
 {
+  errno = 0;
+  FUNC(remainder) (1.625, 1.0);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
 
   START (remainder);
 
@@ -3424,6 +3575,12 @@ remquo_test (void)
   /* x is needed.  */
   int x;
 
+  errno = 0;
+  FUNC(remquo) (1.625, 1.0, &x);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (remquo);
 
   TEST_ffI_f1 (remquo, 1, 0, nan_value, IGNORE, INVALID_EXCEPTION);
@@ -3637,6 +3794,12 @@ sincos_test (void)
 {
   FLOAT sin_res, cos_res;
 
+  errno = 0;
+  FUNC(sincos) (0, &sin_res, &cos_res);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (sincos);
 
   /* sincos is treated differently because it returns void.  */
@@ -3658,6 +3821,12 @@ sincos_test (void)
 static void
 sinh_test (void)
 {
+  errno = 0;
+  FUNC(sinh) (0.7);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (sinh);
   TEST_f_f (sinh, 0, 0);
   TEST_f_f (sinh, minus_zero, minus_zero);
@@ -3732,6 +3901,12 @@ tan_test (void)
 static void
 tanh_test (void)
 {
+  errno = 0;
+  FUNC(tanh) (0.7);
+  if (errno == ENOSYS)
+    /* Function not implemented.  */
+    return;
+
   START (tanh);
 
   TEST_f_f (tanh, 0, 0);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]