This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.17-16-g085ec07


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  085ec079e37b0013b421c97b467c6b8ea36a1289 (commit)
      from  c93c5dec54a64563ce85b511053bd22161085d77 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=085ec079e37b0013b421c97b467c6b8ea36a1289

commit 085ec079e37b0013b421c97b467c6b8ea36a1289
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Sat Dec 29 06:56:04 2012 +0530

    Demystify the magic number 134217729.0
    
    The number 134217729.0 gets used in various places in e_pow.c but
    there is no explanation of what that number is.  Add that explanation.

diff --git a/ChangeLog b/ChangeLog
index 4ac86e2..0af916d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-12-29  Siddhesh Poyarekar  <siddhesh@redhat.com>
+
+	* sysdeps/ieee754/dbl-64/branred.h: Include dla.h.
+	(split): Use macro CN instead of the bare value.
+	* sysdeps/ieee754/dbl-64/dla.h: Add comment to explain why CN
+	could be used.
+	* sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Use CN
+	instead of the bare value.
+	(power1): Likewise.
+
 2012-12-28  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
 	* sysdeps/ieee754/dbl-64/mpatan.c (__mpatan): Remove
diff --git a/sysdeps/ieee754/dbl-64/branred.h b/sysdeps/ieee754/dbl-64/branred.h
index c1e7354..c0a6e78 100644
--- a/sysdeps/ieee754/dbl-64/branred.h
+++ b/sysdeps/ieee754/dbl-64/branred.h
@@ -1,7 +1,7 @@
 /*
  * IBM Accurate Mathematical Library
  * Written by International Business Machines Corp.
- * Copyright (C) 2001 Free Software Foundation, Inc.
+ * Copyright (C) 2001-2012 Free Software Foundation, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -26,6 +26,7 @@
 #ifndef BRANRED_H
 #define BRANRED_H
 
+#include <dla.h>
 
 #ifdef BIG_ENDI
 static const mynumber
@@ -74,6 +75,6 @@ static const double toverp[75] = { /*  2/ PI base 24*/
   12618859.0,  4703257.0, 12806093.0, 14477321.0,  2786137.0,
   12875403.0,  9837734.0, 14528324.0, 13719321.0,   343717.0 };
 
-static const double split =  134217729.0;
+static const double split =  CN;	/* 2^27 + 1 */
 
 #endif
diff --git a/sysdeps/ieee754/dbl-64/dla.h b/sysdeps/ieee754/dbl-64/dla.h
index c92fcfe..3feb3d4 100644
--- a/sysdeps/ieee754/dbl-64/dla.h
+++ b/sysdeps/ieee754/dbl-64/dla.h
@@ -1,7 +1,7 @@
 /*
  * IBM Accurate Mathematical Library
  * Written by International Business Machines Corp.
- * Copyright (C) 2001, 2011 Free Software Foundation, Inc.
+ * Copyright (C) 2001-2012 Free Software Foundation, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -34,7 +34,8 @@
 /* IEEE double.                                                        */
 /***********************************************************************/
 
-/* CN = 1+2**27 = '41a0000002000000' IEEE double format */
+/* CN = 1+2**27 = '41a0000002000000' IEEE double format.  Use it to split a
+   double for better accuracy.  */
 #define  CN   134217729.0
 
 
diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c
index 5131718..1d535cb 100644
--- a/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/sysdeps/ieee754/dbl-64/e_pow.c
@@ -95,10 +95,10 @@ __ieee754_pow(double x, double y) {
     if (ABS (y) < 0x1p-64)
       y = y < 0 ? -0x1p-64 : 0x1p-64;
     z = log1(x,&aa,&error);                                 /* x^y  =e^(y log (X)) */
-    t = y*134217729.0;
+    t = y*CN;
     y1 = t - (t-y);
     y2 = y - y1;
-    t = z*134217729.0;
+    t = z*CN;
     a1 = t - (t-z);
     a2 = (z - a1)+aa;
     a = y1*a1;
@@ -182,10 +182,10 @@ SECTION
 power1(double x, double y) {
   double z,a,aa,error, t,a1,a2,y1,y2;
   z = my_log2(x,&aa,&error);
-  t = y*134217729.0;
+  t = y*CN;
   y1 = t - (t-y);
   y2 = y - y1;
-  t = z*134217729.0;
+  t = z*CN;
   a1 = t - (t-z);
   a2 = z - a1;
   a = y*z;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                        |   10 ++++++++++
 sysdeps/ieee754/dbl-64/branred.h |    5 +++--
 sysdeps/ieee754/dbl-64/dla.h     |    5 +++--
 sysdeps/ieee754/dbl-64/e_pow.c   |    8 ++++----
 4 files changed, 20 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


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