summary refs log tree commit diff
path: root/sysdeps/ieee754
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-06-17 23:58:15 +0000
committerUlrich Drepper <drepper@redhat.com>2004-06-17 23:58:15 +0000
commit7c370086323e3915607c4b1021c817746ac991c9 (patch)
treeab382b3dea191b708ddde13b151473764337ffb9 /sysdeps/ieee754
parentc7be5c15e2fbccdc00b970c3b5b9c27e95dee5be (diff)
downloadglibc-7c370086323e3915607c4b1021c817746ac991c9.tar.gz
glibc-7c370086323e3915607c4b1021c817746ac991c9.tar.xz
glibc-7c370086323e3915607c4b1021c817746ac991c9.zip
Update.
2004-06-13  Kaz Kojima  <kkojima@rr.iij4u.or.jp>

	* sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h (pthread_cond_t):
	Add __data.__futex field, reshuffle __data.__clock.
	* sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S
	(__pthread_cond_signal): Increment __futex at the same time as
	__wakeup_seq or __total_seq.  Pass address of __futex instead of
	address of low 32-bits of __wakeup_seq to futex syscall.
	* sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
	(__pthread_cond_wait): Likewise.  Pass __futex value from before
	releasing internal lock to FUTEX_WAIT.
	* sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
	(__pthread_cond_timedwait): Likewise.
	* sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S
	(FUTEX_CMP_REQUEUE): Define.
	(__pthread_cond_broadcast): Set __futex to 2 * __total_seq.
	Use FUTEX_CMP_REQUEUE operation instead of FUTEX_REQUEUE.
	Pass __futex value from before the unlock and __futex address instead
	of address of low 32-bits of __wakeup_seq to futex syscall.
	Fallback to FUTEX_WAKE all on any errors.
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r--sysdeps/ieee754/dbl-64/e_sqrt.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_sqrt.c b/sysdeps/ieee754/dbl-64/e_sqrt.c
index 15ba98d5e7..f7e8055491 100644
--- a/sysdeps/ieee754/dbl-64/e_sqrt.c
+++ b/sysdeps/ieee754/dbl-64/e_sqrt.c
@@ -41,7 +41,7 @@
 #include "math_private.h"
 
 /*********************************************************************/
-/* An ultimate aqrt routine. Given an IEEE double machine number x   */
+/* An ultimate sqrt routine. Given an IEEE double machine number x   */
 /* it computes the correctly rounded (to nearest) value of square    */
 /* root of x.                                                        */
 /*********************************************************************/
@@ -52,7 +52,7 @@ double __ieee754_sqrt(double x) {
     rt1 = 4.99999999495955425917856814202739E-01,
     rt2 = 3.75017500867345182581453026130850E-01,
     rt3 = 3.12523626554518656309172508769531E-01;
-  static const double big =  134217728.0, big1 =  134217729.0;
+  static const double big =  134217728.0;
   double y,t,del,res,res1,hy,z,zz,p,hx,tx,ty,s;
   mynumber a,c={{0,0}};
   int4 k;
@@ -79,13 +79,10 @@ double __ieee754_sqrt(double x) {
     }
   }
   else {
-    if (k>0x7ff00000)            /* x -> infinity */
-       return (big1-big1)/(big-big);
-      if (k<0x00100000) {        /* x -> -infinity */
-      if (x==0) return x;
-      if (k<0) return (big1-big1)/(big-big);
-      else return tm256.x*__ieee754_sqrt(x*t512.x);
-    }
-    else return (a.i[LOW_HALF]==0)?x:(big1-big1)/(big-big);
+    if ((k & 0x7ff00000) == 0x7ff00000)
+      return x*x+x;	/* sqrt(NaN)=NaN, sqrt(+inf)=+inf, sqrt(-inf)=sNaN */
+    if (x==0) return x;	/* sqrt(+0)=+0, sqrt(-0)=-0 */
+    if (k<0) return (x-x)/(x-x); /* sqrt(-ve)=sNaN */
+    return tm256.x*__ieee754_sqrt(x*t512.x);
   }
 }