bug-gnulib
[Top][All Lists]
Advanced

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

Re: new module 'frexp'


From: Bruno Haible
Subject: Re: new module 'frexp'
Date: Thu, 22 Mar 2007 12:51:57 +0100
User-agent: KMail/1.5.4

Paolo Bonzini wrote:
> I think you can zap my algorithm from the new file

OK, I thought you would debug the test failure and give permission to use it
under LGPL. Anyway. So, I'm removing this algorithm:


2007-03-22  Bruno Haible  <address@hidden>

        * lib/frexp.c: Remove older implementation that uses divisions.

*** lib/frexp.c 22 Mar 2007 03:59:38 -0000      1.1
--- lib/frexp.c 22 Mar 2007 11:48:10 -0000
***************
*** 15,20 ****
--- 15,23 ----
     with this program; if not, write to the Free Software Foundation,
     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
  
+ /* Written by Paolo Bonzini <address@hidden>, 2003, and
+    Bruno Haible <address@hidden>, 2007.  */
+ 
  #include <config.h>
  
  #if !(defined USE_LONG_DOUBLE && !HAVE_LONG_DOUBLE)
***************
*** 65,114 ****
        sign = -1;
      }
  
-   if (0)
      {
-       /* Implementation contributed by Paolo Bonzini.
-          Disabled because it's under GPL and doesn't pass the tests.  */
- 
-       /* Since the exponent is an 'int', it fits in 64 bits.  Therefore the
-        loops are executed no more than 64 times.  */
-       DOUBLE exponents[64];
-       DOUBLE *next;
-       int bit;
- 
-       exponent = 0;
-       if (x >= L_(1.0))
-       {
-         for (next = exponents, exponents[0] = L_(2.0), bit = 1;
-              *next <= x + x;
-              bit <<= 1, next[1] = next[0] * next[0], next++);
- 
-         for (; next >= exponents; bit >>= 1, next--)
-           if (x + x >= *next)
-             {
-               x /= *next;
-               exponent |= bit;
-             }
-       }
-       else if (x < L_(0.5))
-       {
-         for (next = exponents, exponents[0] = L_(0.5), bit = 1;
-              *next > x;
-              bit <<= 1, next[1] = next[0] * next[0], next++);
- 
-         for (; next >= exponents; bit >>= 1, next--)
-           if (x < *next)
-             {
-               x /= *next;
-               exponent |= bit;
-             }
-         exponent = - exponent;
-       }
-     }
-   else
-     {
-       /* Implementation contributed by Bruno Haible.  */
- 
        /* Since the exponent is an 'int', it fits in 64 bits.  Therefore the
         loops are executed no more than 64 times.  */
        DOUBLE pow2[64]; /* pow2[i] = 2^2^i */
--- 68,74 ----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]