]> sourceware.org Git - glibc.git/commitdiff
Fix sign errr in some cacosh results
authorRichard B. Kreckel <kreckel@ginac.de>
Thu, 22 Dec 2011 02:01:29 +0000 (21:01 -0500)
committerUlrich Drepper <drepper@gmail.com>
Thu, 22 Dec 2011 02:01:29 +0000 (21:01 -0500)
ChangeLog
NEWS
math/s_cacosh.c
math/s_cacoshf.c
math/s_cacoshl.c

index 51f148d41e36a15c924f6ab229d8465208bce915..1ccc3ddab06049f09e3a5b9e26c069e398252851 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-11-18  Richard B. Kreckel  <kreckel@ginac.de>
+
+       [BZ #13305]
+       * math/s_cacosh.c: Fix rare miscomputation in cacosh().
+       * math/s_cacoshf.c: Likewise.
+       * math/s_cacoshl.c: Likewise.
+
 2011-12-21  Ulrich Drepper  <drepper@gmail.com>
 
        [BZ #13439]
diff --git a/NEWS b/NEWS
index aba4a8db7520128c1e7b5b8cf0578d2d3d02f3ca..7e4e1692e954280b0e9d6bd0f416580793860a39 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,8 +12,8 @@ Version 2.15
   6779, 6783, 9696, 10103, 10709, 11589, 12403, 12847, 12868, 12852, 12874,
   12885, 12892, 12907, 12922, 12935, 13007, 13021, 13067, 13068, 13090,
   13092, 13114, 13118, 13123, 13134, 13138, 13147, 13150, 13179, 13192,
-  13268, 13276, 13291, 13335, 13337, 13344, 13358, 13367, 13439, 13446,
-  13472, 13484, 13506, 13515, 13524
+  13268, 13276, 13291, 13305, 13335, 13337, 13344, 13358, 13367, 13439,
+  13446, 13472, 13484, 13506, 13515, 13524
 
 * New program pldd to list loaded object of a process
   Implemented by Ulrich Drepper.
index bec6d3827e2179f8b239cb79e6fbd5cdb1897106..df5ce6945d48522e5c2e86afccb03488743274b8 100644 (file)
@@ -74,17 +74,13 @@ __cacosh (__complex__ double x)
 
       y = __csqrt (y);
 
-      if (__real__ x < 0.0)
+      if (signbit (__real__ x))
        y = -y;
 
       __real__ y += __real__ x;
       __imag__ y += __imag__ x;
 
       res = __clog (y);
-
-      /* We have to use the positive branch.  */
-      if (__real__ res < 0.0)
-       res = -res;
     }
 
   return res;
index 0d6bd75dd7a1acb9bee5bac86dbff81abe045b3b..aa4696f10b28ad112e49380d45fe12d49a0fcedf 100644 (file)
@@ -1,5 +1,5 @@
 /* Return arc hyperbole cosine for float value.
-   Copyright (C) 1997, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2006, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -67,7 +67,6 @@ __cacoshf (__complex__ float x)
     }
   else
     {
-#if 1
       __complex__ float y;
 
       __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
@@ -75,30 +74,13 @@ __cacoshf (__complex__ float x)
 
       y = __csqrtf (y);
 
-      if (__real__ x < 0.0)
+      if (signbit (__real__ x))
        y = -y;
 
       __real__ y += __real__ x;
       __imag__ y += __imag__ x;
 
       res = __clogf (y);
-#else
-      float re2 = __real__ x * __real__ x;
-      float im2 = __imag__ x * __imag__ x;
-      float sq = re2 - im2 - 1.0;
-      float ro = __ieee754_sqrtf (sq * sq + 4 * re2 * im2);
-      float a = __ieee754_sqrtf ((sq + ro) / 2.0);
-      float b = __ieee754_sqrtf ((-sq + ro) / 2.0);
-
-      __real__ res = 0.5 * __ieee754_logf (re2 + __real__ x * 2 * a
-                                          + im2 + __imag__ x * 2 * b
-                                          + ro);
-      __imag__ res = __ieee754_atan2f (__imag__ x + b, __real__ x + a);
-#endif
-
-      /* We have to use the positive branch.  */
-      if (__real__ res < 0.0)
-       res = -res;
     }
 
   return res;
index 36f7a5f70e135be99ca640097b2ce15f454a9981..b90b196959f8c479b81d810101f334e0001c8ef7 100644 (file)
@@ -74,17 +74,13 @@ __cacoshl (__complex__ long double x)
 
       y = __csqrtl (y);
 
-      if (__real__ x < 0.0)
+      if (signbit (__real__ x))
        y = -y;
 
       __real__ y += __real__ x;
       __imag__ y += __imag__ x;
 
       res = __clogl (y);
-
-      /* We have to use the positive branch.  */
-      if (__real__ res < 0.0)
-       res = -res;
     }
 
   return res;
This page took 0.053297 seconds and 5 git commands to generate.