[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commits] r22647 - in /fsf/trunk/libc: ./ math/ sysdeps/i386/fpu/ sysdeps/ieee754/ldbl-128/ sysdeps/ieee754/ldbl-96/ sysdeps/x86_64/fpu/



Author: eglibc
Date: Sun Mar 17 00:02:46 2013
New Revision: 22647

Log:
Import glibc-mainline for 2013-03-17

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/math/libm-test.inc
    fsf/trunk/libc/math/test-snan.c
    fsf/trunk/libc/sysdeps/i386/fpu/libm-test-ulps
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128/e_j0l.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128/e_j1l.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_j1l.c
    fsf/trunk/libc/sysdeps/x86_64/fpu/libm-test-ulps

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sun Mar 17 00:02:46 2013
@@ -1,3 +1,31 @@
+2013-03-16  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	[BZ #15283]
+	* sysdeps/ieee754/ldbl-96/e_j1l.c (__ieee754_y1l): Correct test
+	for arguments at most half maximum finite value.
+	* math/libm-test.inc (j0_test): Add more tests.
+	(j1_test): Likewise.
+	(y0_test): Likewise.
+	(y1_test): Likewise.
+	* sysdeps/i386/fpu/libm-test-ulps: Update.
+	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
+
+	[BZ #14155]
+	* sysdeps/ieee754/ldbl-128/e_j0l.c (__ieee754_j0l): Do not compute
+	1 / x and functions P and Q for arguments above 0x1p256L.
+	(__ieee754_y0l): Likewise.
+	* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): Likewise.
+	(__ieee754_y1l): Likewise.
+	* math/libm-test.inc (j0_test): Do not allow spurious underflows.
+	(j1_test): Likewise.
+	(y0_test): Likewise.
+	(y1_test): Likewise.
+
+2013-03-16  Thomas Schwinge  <thomas@xxxxxxxxxxxxxxxx>
+
+	* math/test-snan.c (TEST_FUNC): Add and use minus_sNaN_var
+	variable.
+
 2013-03-15  Roland McGrath  <roland@xxxxxxxxxxxxx>
 
 	* elf/dl-support.c (_dl_aux_init): Ignore zero value for AT_PAGESZ.

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Sun Mar 17 00:02:46 2013
@@ -11,7 +11,7 @@
 
   11561, 12723, 13550, 13951, 14142, 14200, 14317, 14327, 14496, 14920,
   14964, 14981, 14982, 14985, 14994, 14996, 15003, 15006, 15020, 15023,
-  15036, 15054, 15055, 15062, 15078, 15160, 15232, 15234.
+  15036, 15054, 15055, 15062, 15078, 15160, 15232, 15234, 15283.
 
 * Add support for calling C++11 thread_local object destructors on thread
   and program exit.  This needs compiler support for offloading C++11

Modified: fsf/trunk/libc/math/libm-test.inc
==============================================================================
--- fsf/trunk/libc/math/libm-test.inc (original)
+++ fsf/trunk/libc/math/libm-test.inc Sun Mar 17 00:02:46 2013
@@ -6243,8 +6243,12 @@
   TEST_f_f (j0, 0x1.d7ce3ap+107L, 2.775523647291230802651040996274861694514e-17L);
 
 #ifndef TEST_FLOAT
-  /* Bug 14155: spurious exception may occur.  */
-  TEST_f_f (j0, -0x1.001000001p+593L, -3.927269966354206207832593635798954916263e-90L, UNDERFLOW_EXCEPTION_OK);
+  TEST_f_f (j0, -0x1.001000001p+593L, -3.927269966354206207832593635798954916263e-90L);
+#endif
+
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+  TEST_f_f (j0, 0x1p16382L, -1.2193782500509000574176799046642541129387e-2466L);
+  TEST_f_f (j0, 0x1p16383L, 9.5859502826270374691362975419147645151233e-2467L);
 #endif
 
   END (j0);
@@ -6285,8 +6289,12 @@
   TEST_f_f (j1, 0x1.3ffp+74L, 1.818984347516051243459364437186082741567e-12L);
 
 #ifndef TEST_FLOAT
-  /* Bug 14155: spurious exception may occur.  */
-  TEST_f_f (j1, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L, UNDERFLOW_EXCEPTION_OK);
+  TEST_f_f (j1, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L);
+#endif
+
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+  TEST_f_f (j1, 0x1p16382L, 8.0839224448726336195866026476176740513439e-2467L);
+  TEST_f_f (j1, 0x1p16383L, -3.8895531955766020648617743624167352352217e-2467L);
 #endif
 
   END (j1);
@@ -10457,8 +10465,12 @@
   TEST_f_f (y0, 0x1.3ffp+74L, 1.818984347516051243459467456433028748678e-12L);
 
 #ifndef TEST_FLOAT
-  /* Bug 14155: spurious exception may occur.  */
-  TEST_f_f (y0, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L, UNDERFLOW_EXCEPTION_OK);
+  TEST_f_f (y0, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L);
+#endif
+
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+  TEST_f_f (y0, 0x1p16382L, 8.0839224448726336195866026476176740513439e-2467L);
+  TEST_f_f (y0, 0x1p16383L, -3.8895531955766020648617743624167352352217e-2467L);
 #endif
 
   TEST_f_f (y0, 0x1p-10L, -4.4865150767109739412411806297168793661098L);
@@ -10511,8 +10523,12 @@
   TEST_f_f (y1, 0x1.27e204p+99L, -8.881610148467797208469612080785210013461e-16L);
 
 #ifndef TEST_FLOAT
-  /* Bug 14155: spurious exception may occur.  */
-  TEST_f_f (y1, 0x1.001000001p+593L, 3.927269966354206207832593635798954916263e-90L, UNDERFLOW_EXCEPTION_OK);
+  TEST_f_f (y1, 0x1.001000001p+593L, 3.927269966354206207832593635798954916263e-90L);
+#endif
+
+#if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384
+  TEST_f_f (y1, 0x1p16382L, 1.2193782500509000574176799046642541129387e-2466L);
+  TEST_f_f (y1, 0x1p16383L, -9.5859502826270374691362975419147645151233e-2467L);
 #endif
 
   TEST_f_f (y1, 0x1p-10L, -6.5190099301063115047395187618929589514382e+02L);

Modified: fsf/trunk/libc/math/test-snan.c
==============================================================================
--- fsf/trunk/libc/math/test-snan.c (original)
+++ fsf/trunk/libc/math/test-snan.c Sun Mar 17 00:02:46 2013
@@ -94,6 +94,7 @@
   /* A sNaN is only guaranteed to be representable in variables with */	      \
   /* static (or thread-local) storage duration.  */			      \
   static volatile FLOAT sNaN_var = __builtin_nans ## SUFFIX ("");	      \
+  static volatile FLOAT minus_sNaN_var = -__builtin_nans ## SUFFIX ("");      \
   fenv_t saved_fenv;							      \
 									      \
   zero_var = 0.0;							      \
@@ -105,6 +106,7 @@
   (void) &one_var;							      \
   (void) &qNaN_var;							      \
   (void) &sNaN_var;							      \
+  (void) &minus_sNaN_var;						      \
   (void) &Inf_var;							      \
 									      \
   set_sigaction_FP ();							      \
@@ -147,7 +149,7 @@
       printf (#FLOAT " isnan (-sNaN) raised SIGFPE\n");			      \
       errors++;								      \
     } else {								      \
-      check (#FLOAT " isnan (-sNaN)", isnan (-sNaN_var));		      \
+      check (#FLOAT " isnan (-sNaN)", isnan (minus_sNaN_var));		      \
     }									      \
 									      \
   feclearexcept(FE_ALL_EXCEPT);						      \
@@ -187,7 +189,7 @@
       printf (#FLOAT " isinf (-sNaN) raised SIGFPE\n");			      \
       errors++;								      \
     } else {								      \
-      check (#FLOAT " isinf (-sNaN)", !isinf (-sNaN_var));		      \
+      check (#FLOAT " isinf (-sNaN)", !isinf (minus_sNaN_var));		      \
     }									      \
 									      \
   feclearexcept(FE_ALL_EXCEPT);						      \
@@ -227,7 +229,7 @@
       printf (#FLOAT " isfinite (-sNaN) raised SIGFPE\n");		      \
       errors++;								      \
     } else {								      \
-      check (#FLOAT " isfinite (-sNaN)", !isfinite (-sNaN_var));	      \
+      check (#FLOAT " isfinite (-sNaN)", !isfinite (minus_sNaN_var));	      \
     }									      \
 									      \
   feclearexcept(FE_ALL_EXCEPT);						      \
@@ -267,7 +269,7 @@
       printf (#FLOAT " isnormal (-sNaN) raised SIGFPE\n");		      \
       errors++;								      \
     } else {								      \
-      check (#FLOAT " isnormal (-sNaN)", !isnormal (-sNaN_var));	      \
+      check (#FLOAT " isnormal (-sNaN)", !isnormal (minus_sNaN_var));	      \
     }									      \
 									      \
   feclearexcept(FE_ALL_EXCEPT);						      \
@@ -297,7 +299,7 @@
       printf (#FLOAT " fpclassify (sNaN) isnormal SIGFPE\n");		      \
       errors++;								      \
     } else {								      \
-      check (#FLOAT " fpclassify (sNaN)", (fpclassify (sNaN_var)==FP_NAN));   \
+      check (#FLOAT " fpclassify (sNaN)", fpclassify (sNaN_var) == FP_NAN);   \
     }									      \
 									      \
   feclearexcept(FE_ALL_EXCEPT);						      \
@@ -307,7 +309,8 @@
       printf (#FLOAT " fpclassify (-sNaN) raised SIGFPE\n");		      \
       errors++;								      \
     } else {								      \
-      check (#FLOAT " fpclassify (-sNaN)", (fpclassify (-sNaN_var)==FP_NAN)); \
+      check (#FLOAT " fpclassify (-sNaN)",				      \
+	     fpclassify (minus_sNaN_var) == FP_NAN);			      \
     }									      \
 									      \
   fesetenv(&saved_fenv); /* restore saved fenv */			      \

Modified: fsf/trunk/libc/sysdeps/i386/fpu/libm-test-ulps
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/libm-test-ulps (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/libm-test-ulps Sun Mar 17 00:02:46 2013
@@ -2475,6 +2475,9 @@
 Test "j0 (0x1.d7ce3ap+107) == 2.775523647291230802651040996274861694514e-17":
 float: 1
 ifloat: 1
+Test "j0 (0x1p16382) == -1.2193782500509000574176799046642541129387e-2466":
+ildouble: 1
+ldouble: 1
 Test "j0 (10.0) == -0.245935764451348335197760862485328754":
 double: 3
 float: 1
@@ -2508,6 +2511,9 @@
 Test "j1 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127":
 double: 1
 idouble: 1
+Test "j1 (0x1p16382) == 8.0839224448726336195866026476176740513439e-2467":
+ildouble: 1
+ldouble: 1
 Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
 double: 2
 float: 1
@@ -3285,6 +3291,9 @@
 Test "y0 (0x1p-80) == -3.5375500319532942168707373066828113573541e+1":
 double: 1
 idouble: 1
+Test "y0 (0x1p16382) == 8.0839224448726336195866026476176740513439e-2467":
+ildouble: 1
+ldouble: 1
 Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
 double: 2
 float: 1
@@ -3329,6 +3338,9 @@
 Test "y1 (0x1p-10) == -6.5190099301063115047395187618929589514382e+02":
 float: 1
 ifloat: 1
+Test "y1 (0x1p16382) == 1.2193782500509000574176799046642541129387e-2466":
+ildouble: 1
+ldouble: 1
 Test "y1 (1.0) == -0.781212821300288716547150000047964821":
 double: 1
 idouble: 1

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128/e_j0l.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128/e_j0l.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128/e_j0l.c Sun Mar 17 00:02:46 2013
@@ -700,67 +700,6 @@
       return p;
     }
 
-  xinv = 1.0L / xx;
-  z = xinv * xinv;
-  if (xinv <= 0.25)
-    {
-      if (xinv <= 0.125)
-	{
-	  if (xinv <= 0.0625)
-	    {
-	      p = neval (z, P16_IN, NP16_IN) / deval (z, P16_ID, NP16_ID);
-	      q = neval (z, Q16_IN, NQ16_IN) / deval (z, Q16_ID, NQ16_ID);
-	    }
-	  else
-	    {
-	      p = neval (z, P8_16N, NP8_16N) / deval (z, P8_16D, NP8_16D);
-	      q = neval (z, Q8_16N, NQ8_16N) / deval (z, Q8_16D, NQ8_16D);
-	    }
-	}
-      else if (xinv <= 0.1875)
-	{
-	  p = neval (z, P5_8N, NP5_8N) / deval (z, P5_8D, NP5_8D);
-	  q = neval (z, Q5_8N, NQ5_8N) / deval (z, Q5_8D, NQ5_8D);
-	}
-      else
-	{
-	  p = neval (z, P4_5N, NP4_5N) / deval (z, P4_5D, NP4_5D);
-	  q = neval (z, Q4_5N, NQ4_5N) / deval (z, Q4_5D, NQ4_5D);
-	}
-    }				/* .25 */
-  else /* if (xinv <= 0.5) */
-    {
-      if (xinv <= 0.375)
-	{
-	  if (xinv <= 0.3125)
-	    {
-	      p = neval (z, P3r2_4N, NP3r2_4N) / deval (z, P3r2_4D, NP3r2_4D);
-	      q = neval (z, Q3r2_4N, NQ3r2_4N) / deval (z, Q3r2_4D, NQ3r2_4D);
-	    }
-	  else
-	    {
-	      p = neval (z, P2r7_3r2N, NP2r7_3r2N)
-		  / deval (z, P2r7_3r2D, NP2r7_3r2D);
-	      q = neval (z, Q2r7_3r2N, NQ2r7_3r2N)
-		  / deval (z, Q2r7_3r2D, NQ2r7_3r2D);
-	    }
-	}
-      else if (xinv <= 0.4375)
-	{
-	  p = neval (z, P2r3_2r7N, NP2r3_2r7N)
-	      / deval (z, P2r3_2r7D, NP2r3_2r7D);
-	  q = neval (z, Q2r3_2r7N, NQ2r3_2r7N)
-	      / deval (z, Q2r3_2r7D, NQ2r3_2r7D);
-	}
-      else
-	{
-	  p = neval (z, P2_2r3N, NP2_2r3N) / deval (z, P2_2r3D, NP2_2r3D);
-	  q = neval (z, Q2_2r3N, NQ2_2r3N) / deval (z, Q2_2r3D, NQ2_2r3D);
-	}
-    }
-  p = 1.0L + z * p;
-  q = z * xinv * q;
-  q = q - 0.125L * xinv;
   /* X = x - pi/4
      cos(X) = cos(x) cos(pi/4) + sin(x) sin(pi/4)
      = 1/sqrt(2) * (cos(x) + sin(x))
@@ -776,6 +715,71 @@
     cc = z / ss;
   else
     ss = z / cc;
+
+  if (xx > 0x1p256L)
+    return ONEOSQPI * cc / __ieee754_sqrtl (xx);
+
+  xinv = 1.0L / xx;
+  z = xinv * xinv;
+  if (xinv <= 0.25)
+    {
+      if (xinv <= 0.125)
+	{
+	  if (xinv <= 0.0625)
+	    {
+	      p = neval (z, P16_IN, NP16_IN) / deval (z, P16_ID, NP16_ID);
+	      q = neval (z, Q16_IN, NQ16_IN) / deval (z, Q16_ID, NQ16_ID);
+	    }
+	  else
+	    {
+	      p = neval (z, P8_16N, NP8_16N) / deval (z, P8_16D, NP8_16D);
+	      q = neval (z, Q8_16N, NQ8_16N) / deval (z, Q8_16D, NQ8_16D);
+	    }
+	}
+      else if (xinv <= 0.1875)
+	{
+	  p = neval (z, P5_8N, NP5_8N) / deval (z, P5_8D, NP5_8D);
+	  q = neval (z, Q5_8N, NQ5_8N) / deval (z, Q5_8D, NQ5_8D);
+	}
+      else
+	{
+	  p = neval (z, P4_5N, NP4_5N) / deval (z, P4_5D, NP4_5D);
+	  q = neval (z, Q4_5N, NQ4_5N) / deval (z, Q4_5D, NQ4_5D);
+	}
+    }				/* .25 */
+  else /* if (xinv <= 0.5) */
+    {
+      if (xinv <= 0.375)
+	{
+	  if (xinv <= 0.3125)
+	    {
+	      p = neval (z, P3r2_4N, NP3r2_4N) / deval (z, P3r2_4D, NP3r2_4D);
+	      q = neval (z, Q3r2_4N, NQ3r2_4N) / deval (z, Q3r2_4D, NQ3r2_4D);
+	    }
+	  else
+	    {
+	      p = neval (z, P2r7_3r2N, NP2r7_3r2N)
+		  / deval (z, P2r7_3r2D, NP2r7_3r2D);
+	      q = neval (z, Q2r7_3r2N, NQ2r7_3r2N)
+		  / deval (z, Q2r7_3r2D, NQ2r7_3r2D);
+	    }
+	}
+      else if (xinv <= 0.4375)
+	{
+	  p = neval (z, P2r3_2r7N, NP2r3_2r7N)
+	      / deval (z, P2r3_2r7D, NP2r3_2r7D);
+	  q = neval (z, Q2r3_2r7N, NQ2r3_2r7N)
+	      / deval (z, Q2r3_2r7D, NQ2r3_2r7D);
+	}
+      else
+	{
+	  p = neval (z, P2_2r3N, NP2_2r3N) / deval (z, P2_2r3D, NP2_2r3D);
+	  q = neval (z, Q2_2r3N, NQ2_2r3N) / deval (z, Q2_2r3D, NQ2_2r3D);
+	}
+    }
+  p = 1.0L + z * p;
+  q = z * xinv * q;
+  q = q - 0.125L * xinv;
   z = ONEOSQPI * (p * cc - q * ss) / __ieee754_sqrtl (xx);
   return z;
 }
@@ -843,67 +847,6 @@
       return p;
     }
 
-  xinv = 1.0L / xx;
-  z = xinv * xinv;
-  if (xinv <= 0.25)
-    {
-      if (xinv <= 0.125)
-	{
-	  if (xinv <= 0.0625)
-	    {
-	      p = neval (z, P16_IN, NP16_IN) / deval (z, P16_ID, NP16_ID);
-	      q = neval (z, Q16_IN, NQ16_IN) / deval (z, Q16_ID, NQ16_ID);
-	    }
-	  else
-	    {
-	      p = neval (z, P8_16N, NP8_16N) / deval (z, P8_16D, NP8_16D);
-	      q = neval (z, Q8_16N, NQ8_16N) / deval (z, Q8_16D, NQ8_16D);
-	    }
-	}
-      else if (xinv <= 0.1875)
-	{
-	  p = neval (z, P5_8N, NP5_8N) / deval (z, P5_8D, NP5_8D);
-	  q = neval (z, Q5_8N, NQ5_8N) / deval (z, Q5_8D, NQ5_8D);
-	}
-      else
-	{
-	  p = neval (z, P4_5N, NP4_5N) / deval (z, P4_5D, NP4_5D);
-	  q = neval (z, Q4_5N, NQ4_5N) / deval (z, Q4_5D, NQ4_5D);
-	}
-    }				/* .25 */
-  else /* if (xinv <= 0.5) */
-    {
-      if (xinv <= 0.375)
-	{
-	  if (xinv <= 0.3125)
-	    {
-	      p = neval (z, P3r2_4N, NP3r2_4N) / deval (z, P3r2_4D, NP3r2_4D);
-	      q = neval (z, Q3r2_4N, NQ3r2_4N) / deval (z, Q3r2_4D, NQ3r2_4D);
-	    }
-	  else
-	    {
-	      p = neval (z, P2r7_3r2N, NP2r7_3r2N)
-		  / deval (z, P2r7_3r2D, NP2r7_3r2D);
-	      q = neval (z, Q2r7_3r2N, NQ2r7_3r2N)
-		  / deval (z, Q2r7_3r2D, NQ2r7_3r2D);
-	    }
-	}
-      else if (xinv <= 0.4375)
-	{
-	  p = neval (z, P2r3_2r7N, NP2r3_2r7N)
-	      / deval (z, P2r3_2r7D, NP2r3_2r7D);
-	  q = neval (z, Q2r3_2r7N, NQ2r3_2r7N)
-	      / deval (z, Q2r3_2r7D, NQ2r3_2r7D);
-	}
-      else
-	{
-	  p = neval (z, P2_2r3N, NP2_2r3N) / deval (z, P2_2r3D, NP2_2r3D);
-	  q = neval (z, Q2_2r3N, NQ2_2r3N) / deval (z, Q2_2r3D, NQ2_2r3D);
-	}
-    }
-  p = 1.0L + z * p;
-  q = z * xinv * q;
-  q = q - 0.125L * xinv;
   /* X = x - pi/4
      cos(X) = cos(x) cos(pi/4) + sin(x) sin(pi/4)
      = 1/sqrt(2) * (cos(x) + sin(x))
@@ -919,6 +862,71 @@
     cc = z / ss;
   else
     ss = z / cc;
+
+  if (xx > 0x1p256L)
+    return ONEOSQPI * ss / __ieee754_sqrtl (x);
+
+  xinv = 1.0L / xx;
+  z = xinv * xinv;
+  if (xinv <= 0.25)
+    {
+      if (xinv <= 0.125)
+	{
+	  if (xinv <= 0.0625)
+	    {
+	      p = neval (z, P16_IN, NP16_IN) / deval (z, P16_ID, NP16_ID);
+	      q = neval (z, Q16_IN, NQ16_IN) / deval (z, Q16_ID, NQ16_ID);
+	    }
+	  else
+	    {
+	      p = neval (z, P8_16N, NP8_16N) / deval (z, P8_16D, NP8_16D);
+	      q = neval (z, Q8_16N, NQ8_16N) / deval (z, Q8_16D, NQ8_16D);
+	    }
+	}
+      else if (xinv <= 0.1875)
+	{
+	  p = neval (z, P5_8N, NP5_8N) / deval (z, P5_8D, NP5_8D);
+	  q = neval (z, Q5_8N, NQ5_8N) / deval (z, Q5_8D, NQ5_8D);
+	}
+      else
+	{
+	  p = neval (z, P4_5N, NP4_5N) / deval (z, P4_5D, NP4_5D);
+	  q = neval (z, Q4_5N, NQ4_5N) / deval (z, Q4_5D, NQ4_5D);
+	}
+    }				/* .25 */
+  else /* if (xinv <= 0.5) */
+    {
+      if (xinv <= 0.375)
+	{
+	  if (xinv <= 0.3125)
+	    {
+	      p = neval (z, P3r2_4N, NP3r2_4N) / deval (z, P3r2_4D, NP3r2_4D);
+	      q = neval (z, Q3r2_4N, NQ3r2_4N) / deval (z, Q3r2_4D, NQ3r2_4D);
+	    }
+	  else
+	    {
+	      p = neval (z, P2r7_3r2N, NP2r7_3r2N)
+		  / deval (z, P2r7_3r2D, NP2r7_3r2D);
+	      q = neval (z, Q2r7_3r2N, NQ2r7_3r2N)
+		  / deval (z, Q2r7_3r2D, NQ2r7_3r2D);
+	    }
+	}
+      else if (xinv <= 0.4375)
+	{
+	  p = neval (z, P2r3_2r7N, NP2r3_2r7N)
+	      / deval (z, P2r3_2r7D, NP2r3_2r7D);
+	  q = neval (z, Q2r3_2r7N, NQ2r3_2r7N)
+	      / deval (z, Q2r3_2r7D, NQ2r3_2r7D);
+	}
+      else
+	{
+	  p = neval (z, P2_2r3N, NP2_2r3N) / deval (z, P2_2r3D, NP2_2r3D);
+	  q = neval (z, Q2_2r3N, NQ2_2r3N) / deval (z, Q2_2r3D, NQ2_2r3D);
+	}
+    }
+  p = 1.0L + z * p;
+  q = z * xinv * q;
+  q = q - 0.125L * xinv;
   z = ONEOSQPI * (p * ss + q * cc) / __ieee754_sqrtl (x);
   return z;
 }

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128/e_j1l.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128/e_j1l.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128/e_j1l.c Sun Mar 17 00:02:46 2013
@@ -706,67 +706,6 @@
       return p;
     }
 
-  xinv = 1.0L / xx;
-  z = xinv * xinv;
-  if (xinv <= 0.25)
-    {
-      if (xinv <= 0.125)
-	{
-	  if (xinv <= 0.0625)
-	    {
-	      p = neval (z, P16_IN, NP16_IN) / deval (z, P16_ID, NP16_ID);
-	      q = neval (z, Q16_IN, NQ16_IN) / deval (z, Q16_ID, NQ16_ID);
-	    }
-	  else
-	    {
-	      p = neval (z, P8_16N, NP8_16N) / deval (z, P8_16D, NP8_16D);
-	      q = neval (z, Q8_16N, NQ8_16N) / deval (z, Q8_16D, NQ8_16D);
-	    }
-	}
-      else if (xinv <= 0.1875)
-	{
-	  p = neval (z, P5_8N, NP5_8N) / deval (z, P5_8D, NP5_8D);
-	  q = neval (z, Q5_8N, NQ5_8N) / deval (z, Q5_8D, NQ5_8D);
-	}
-      else
-	{
-	  p = neval (z, P4_5N, NP4_5N) / deval (z, P4_5D, NP4_5D);
-	  q = neval (z, Q4_5N, NQ4_5N) / deval (z, Q4_5D, NQ4_5D);
-	}
-    }				/* .25 */
-  else /* if (xinv <= 0.5) */
-    {
-      if (xinv <= 0.375)
-	{
-	  if (xinv <= 0.3125)
-	    {
-	      p = neval (z, P3r2_4N, NP3r2_4N) / deval (z, P3r2_4D, NP3r2_4D);
-	      q = neval (z, Q3r2_4N, NQ3r2_4N) / deval (z, Q3r2_4D, NQ3r2_4D);
-	    }
-	  else
-	    {
-	      p = neval (z, P2r7_3r2N, NP2r7_3r2N)
-		  / deval (z, P2r7_3r2D, NP2r7_3r2D);
-	      q = neval (z, Q2r7_3r2N, NQ2r7_3r2N)
-		  / deval (z, Q2r7_3r2D, NQ2r7_3r2D);
-	    }
-	}
-      else if (xinv <= 0.4375)
-	{
-	  p = neval (z, P2r3_2r7N, NP2r3_2r7N)
-	      / deval (z, P2r3_2r7D, NP2r3_2r7D);
-	  q = neval (z, Q2r3_2r7N, NQ2r3_2r7N)
-	      / deval (z, Q2r3_2r7D, NQ2r3_2r7D);
-	}
-      else
-	{
-	  p = neval (z, P2_2r3N, NP2_2r3N) / deval (z, P2_2r3D, NP2_2r3D);
-	  q = neval (z, Q2_2r3N, NQ2_2r3N) / deval (z, Q2_2r3D, NQ2_2r3D);
-	}
-    }
-  p = 1.0L + z * p;
-  q = z * q;
-  q = q * xinv + 0.375L * xinv;
   /* X = x - 3 pi/4
      cos(X) = cos(x) cos(3 pi/4) + sin(x) sin(3 pi/4)
      = 1/sqrt(2) * (-cos(x) + sin(x))
@@ -781,6 +720,76 @@
     cc = z / ss;
   else
     ss = z / cc;
+
+  if (xx > 0x1p256L)
+    {
+      z = ONEOSQPI * cc / __ieee754_sqrtl (xx);
+      if (x < 0)
+	z = -z;
+      return z;
+    }
+
+  xinv = 1.0L / xx;
+  z = xinv * xinv;
+  if (xinv <= 0.25)
+    {
+      if (xinv <= 0.125)
+	{
+	  if (xinv <= 0.0625)
+	    {
+	      p = neval (z, P16_IN, NP16_IN) / deval (z, P16_ID, NP16_ID);
+	      q = neval (z, Q16_IN, NQ16_IN) / deval (z, Q16_ID, NQ16_ID);
+	    }
+	  else
+	    {
+	      p = neval (z, P8_16N, NP8_16N) / deval (z, P8_16D, NP8_16D);
+	      q = neval (z, Q8_16N, NQ8_16N) / deval (z, Q8_16D, NQ8_16D);
+	    }
+	}
+      else if (xinv <= 0.1875)
+	{
+	  p = neval (z, P5_8N, NP5_8N) / deval (z, P5_8D, NP5_8D);
+	  q = neval (z, Q5_8N, NQ5_8N) / deval (z, Q5_8D, NQ5_8D);
+	}
+      else
+	{
+	  p = neval (z, P4_5N, NP4_5N) / deval (z, P4_5D, NP4_5D);
+	  q = neval (z, Q4_5N, NQ4_5N) / deval (z, Q4_5D, NQ4_5D);
+	}
+    }				/* .25 */
+  else /* if (xinv <= 0.5) */
+    {
+      if (xinv <= 0.375)
+	{
+	  if (xinv <= 0.3125)
+	    {
+	      p = neval (z, P3r2_4N, NP3r2_4N) / deval (z, P3r2_4D, NP3r2_4D);
+	      q = neval (z, Q3r2_4N, NQ3r2_4N) / deval (z, Q3r2_4D, NQ3r2_4D);
+	    }
+	  else
+	    {
+	      p = neval (z, P2r7_3r2N, NP2r7_3r2N)
+		  / deval (z, P2r7_3r2D, NP2r7_3r2D);
+	      q = neval (z, Q2r7_3r2N, NQ2r7_3r2N)
+		  / deval (z, Q2r7_3r2D, NQ2r7_3r2D);
+	    }
+	}
+      else if (xinv <= 0.4375)
+	{
+	  p = neval (z, P2r3_2r7N, NP2r3_2r7N)
+	      / deval (z, P2r3_2r7D, NP2r3_2r7D);
+	  q = neval (z, Q2r3_2r7N, NQ2r3_2r7N)
+	      / deval (z, Q2r3_2r7D, NQ2r3_2r7D);
+	}
+      else
+	{
+	  p = neval (z, P2_2r3N, NP2_2r3N) / deval (z, P2_2r3D, NP2_2r3D);
+	  q = neval (z, Q2_2r3N, NQ2_2r3N) / deval (z, Q2_2r3D, NQ2_2r3D);
+	}
+    }
+  p = 1.0L + z * p;
+  q = z * q;
+  q = q * xinv + 0.375L * xinv;
   z = ONEOSQPI * (p * cc - q * ss) / __ieee754_sqrtl (xx);
   if (x < 0)
     z = -z;
@@ -850,67 +859,6 @@
       return p;
     }
 
-  xinv = 1.0L / xx;
-  z = xinv * xinv;
-  if (xinv <= 0.25)
-    {
-      if (xinv <= 0.125)
-	{
-	  if (xinv <= 0.0625)
-	    {
-	      p = neval (z, P16_IN, NP16_IN) / deval (z, P16_ID, NP16_ID);
-	      q = neval (z, Q16_IN, NQ16_IN) / deval (z, Q16_ID, NQ16_ID);
-	    }
-	  else
-	    {
-	      p = neval (z, P8_16N, NP8_16N) / deval (z, P8_16D, NP8_16D);
-	      q = neval (z, Q8_16N, NQ8_16N) / deval (z, Q8_16D, NQ8_16D);
-	    }
-	}
-      else if (xinv <= 0.1875)
-	{
-	  p = neval (z, P5_8N, NP5_8N) / deval (z, P5_8D, NP5_8D);
-	  q = neval (z, Q5_8N, NQ5_8N) / deval (z, Q5_8D, NQ5_8D);
-	}
-      else
-	{
-	  p = neval (z, P4_5N, NP4_5N) / deval (z, P4_5D, NP4_5D);
-	  q = neval (z, Q4_5N, NQ4_5N) / deval (z, Q4_5D, NQ4_5D);
-	}
-    }				/* .25 */
-  else /* if (xinv <= 0.5) */
-    {
-      if (xinv <= 0.375)
-	{
-	  if (xinv <= 0.3125)
-	    {
-	      p = neval (z, P3r2_4N, NP3r2_4N) / deval (z, P3r2_4D, NP3r2_4D);
-	      q = neval (z, Q3r2_4N, NQ3r2_4N) / deval (z, Q3r2_4D, NQ3r2_4D);
-	    }
-	  else
-	    {
-	      p = neval (z, P2r7_3r2N, NP2r7_3r2N)
-		  / deval (z, P2r7_3r2D, NP2r7_3r2D);
-	      q = neval (z, Q2r7_3r2N, NQ2r7_3r2N)
-		  / deval (z, Q2r7_3r2D, NQ2r7_3r2D);
-	    }
-	}
-      else if (xinv <= 0.4375)
-	{
-	  p = neval (z, P2r3_2r7N, NP2r3_2r7N)
-	      / deval (z, P2r3_2r7D, NP2r3_2r7D);
-	  q = neval (z, Q2r3_2r7N, NQ2r3_2r7N)
-	      / deval (z, Q2r3_2r7D, NQ2r3_2r7D);
-	}
-      else
-	{
-	  p = neval (z, P2_2r3N, NP2_2r3N) / deval (z, P2_2r3D, NP2_2r3D);
-	  q = neval (z, Q2_2r3N, NQ2_2r3N) / deval (z, Q2_2r3D, NQ2_2r3D);
-	}
-    }
-  p = 1.0L + z * p;
-  q = z * q;
-  q = q * xinv + 0.375L * xinv;
   /* X = x - 3 pi/4
      cos(X) = cos(x) cos(3 pi/4) + sin(x) sin(3 pi/4)
      = 1/sqrt(2) * (-cos(x) + sin(x))
@@ -925,6 +873,71 @@
     cc = z / ss;
   else
     ss = z / cc;
+
+  if (xx > 0x1p256L)
+    return ONEOSQPI * ss / __ieee754_sqrtl (xx);
+
+  xinv = 1.0L / xx;
+  z = xinv * xinv;
+  if (xinv <= 0.25)
+    {
+      if (xinv <= 0.125)
+	{
+	  if (xinv <= 0.0625)
+	    {
+	      p = neval (z, P16_IN, NP16_IN) / deval (z, P16_ID, NP16_ID);
+	      q = neval (z, Q16_IN, NQ16_IN) / deval (z, Q16_ID, NQ16_ID);
+	    }
+	  else
+	    {
+	      p = neval (z, P8_16N, NP8_16N) / deval (z, P8_16D, NP8_16D);
+	      q = neval (z, Q8_16N, NQ8_16N) / deval (z, Q8_16D, NQ8_16D);
+	    }
+	}
+      else if (xinv <= 0.1875)
+	{
+	  p = neval (z, P5_8N, NP5_8N) / deval (z, P5_8D, NP5_8D);
+	  q = neval (z, Q5_8N, NQ5_8N) / deval (z, Q5_8D, NQ5_8D);
+	}
+      else
+	{
+	  p = neval (z, P4_5N, NP4_5N) / deval (z, P4_5D, NP4_5D);
+	  q = neval (z, Q4_5N, NQ4_5N) / deval (z, Q4_5D, NQ4_5D);
+	}
+    }				/* .25 */
+  else /* if (xinv <= 0.5) */
+    {
+      if (xinv <= 0.375)
+	{
+	  if (xinv <= 0.3125)
+	    {
+	      p = neval (z, P3r2_4N, NP3r2_4N) / deval (z, P3r2_4D, NP3r2_4D);
+	      q = neval (z, Q3r2_4N, NQ3r2_4N) / deval (z, Q3r2_4D, NQ3r2_4D);
+	    }
+	  else
+	    {
+	      p = neval (z, P2r7_3r2N, NP2r7_3r2N)
+		  / deval (z, P2r7_3r2D, NP2r7_3r2D);
+	      q = neval (z, Q2r7_3r2N, NQ2r7_3r2N)
+		  / deval (z, Q2r7_3r2D, NQ2r7_3r2D);
+	    }
+	}
+      else if (xinv <= 0.4375)
+	{
+	  p = neval (z, P2r3_2r7N, NP2r3_2r7N)
+	      / deval (z, P2r3_2r7D, NP2r3_2r7D);
+	  q = neval (z, Q2r3_2r7N, NQ2r3_2r7N)
+	      / deval (z, Q2r3_2r7D, NQ2r3_2r7D);
+	}
+      else
+	{
+	  p = neval (z, P2_2r3N, NP2_2r3N) / deval (z, P2_2r3D, NP2_2r3D);
+	  q = neval (z, Q2_2r3N, NQ2_2r3N) / deval (z, Q2_2r3D, NQ2_2r3D);
+	}
+    }
+  p = 1.0L + z * p;
+  q = z * q;
+  q = q * xinv + 0.375L * xinv;
   z = ONEOSQPI * (p * ss + q * cc) / __ieee754_sqrtl (xx);
   return z;
 }

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_j1l.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_j1l.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_j1l.c Sun Mar 17 00:02:46 2013
@@ -203,7 +203,7 @@
       __sincosl (x, &s, &c);
       ss = -s - c;
       cc = s - c;
-      if (ix < 0x7fe00000)
+      if (ix < 0x7ffe)
 	{			/* make sure x+x not overflow */
 	  z = __cosl (x + x);
 	  if ((s * c) > zero)

Modified: fsf/trunk/libc/sysdeps/x86_64/fpu/libm-test-ulps
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/fpu/libm-test-ulps (original)
+++ fsf/trunk/libc/sysdeps/x86_64/fpu/libm-test-ulps Sun Mar 17 00:02:46 2013
@@ -2390,6 +2390,9 @@
 Test "j0 (0x1.d7ce3ap+107) == 2.775523647291230802651040996274861694514e-17":
 float: 2
 ifloat: 2
+Test "j0 (0x1p16382) == -1.2193782500509000574176799046642541129387e-2466":
+ildouble: 1
+ldouble: 1
 Test "j0 (10.0) == -0.245935764451348335197760862485328754":
 double: 2
 float: 1
@@ -2420,6 +2423,9 @@
 Test "j1 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127":
 double: 1
 idouble: 1
+Test "j1 (0x1p16382) == 8.0839224448726336195866026476176740513439e-2467":
+ildouble: 1
+ldouble: 1
 Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
 float: 2
 ifloat: 2
@@ -3073,6 +3079,9 @@
 float: 1
 idouble: 1
 ifloat: 1
+Test "y0 (0x1p16382) == 8.0839224448726336195866026476176740513439e-2467":
+ildouble: 1
+ldouble: 1
 Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
 double: 2
 float: 1
@@ -3117,6 +3126,9 @@
 Test "y1 (0x1p-10) == -6.5190099301063115047395187618929589514382e+02":
 double: 1
 idouble: 1
+Test "y1 (0x1p16382) == 1.2193782500509000574176799046642541129387e-2466":
+ildouble: 1
+ldouble: 1
 Test "y1 (1.5) == -0.412308626973911295952829820633445323":
 float: 1
 ifloat: 1

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits