]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Simplify hypotf infinity handling (bug 15918).
authorJoseph Myers <joseph@codesourcery.com>
Tue, 15 Sep 2015 17:24:23 +0000 (17:24 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Tue, 15 Sep 2015 17:24:23 +0000 (17:24 +0000)
Bug 15918 points out that the handling of infinities in hypotf can be
simplified: it's enough to return the absolute value of the infinite
argument without first comparing it to the other argument and possibly
returning that other argument's absolute value.  This patch makes that
cleanup (which should not change how hypotf behaves on any input).

Tested for x86_64.

[BZ #15918]
* sysdeps/ieee754/flt-32/e_hypotf.c (__ieee754_hypotf): Simplify
handling of cases where one argument is an infinity.

ChangeLog
NEWS
sysdeps/ieee754/flt-32/e_hypotf.c

index 4d6f2bb31365b061c3768d13e2f72494d04c3ac7..f807e7cf17608545bfb51ccaf6a905f0e2907f70 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2015-09-15  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #15918]
+       * sysdeps/ieee754/flt-32/e_hypotf.c (__ieee754_hypotf): Simplify
+       handling of cases where one argument is an infinity.
+
        [BZ #18875]
        [BZ #18966]
        * sysdeps/i386/fpu/e_exp10.S (dbl_min): New object.
diff --git a/NEWS b/NEWS
index f782af359eef085daeef65895e35ced3f67d35f7..a09ba38f738e47d9b1c34929d1d28d7879ca11b3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,12 +9,12 @@ Version 2.23
 
 * The following bugs are resolved with this release:
 
-  2542, 2543, 2558, 2898, 14341, 14912, 15786, 16141, 16517, 16519, 16520,
-  16521, 16734, 16973, 16985, 17787, 17905, 18084, 18086, 18240, 18265,
-  18370, 18421, 18480, 18525, 18610, 18618, 18647, 18661, 18674, 18675,
-  18681, 18757, 18778, 18781, 18787, 18789, 18790, 18795, 18796, 18820,
-  18823, 18824, 18863, 18870, 18873, 18875, 18887, 18921, 18952, 18961,
-  18966.
+  2542, 2543, 2558, 2898, 14341, 14912, 15786, 15918, 16141, 16517, 16519,
+  16520, 16521, 16734, 16973, 16985, 17787, 17905, 18084, 18086, 18240,
+  18265, 18370, 18421, 18480, 18525, 18610, 18618, 18647, 18661, 18674,
+  18675, 18681, 18757, 18778, 18781, 18787, 18789, 18790, 18795, 18796,
+  18820, 18823, 18824, 18863, 18870, 18873, 18875, 18887, 18921, 18952,
+  18961, 18966.
 
 * The obsolete header <regexp.h> has been removed.  Programs that require
   this header must be updated to use <regex.h> instead.
index 8f499b5fdeb40ff4861a5b35dbbb3ecf6161c9c0..717b82e42f08a8180405fb0a17430b50b692e1a9 100644 (file)
@@ -27,17 +27,9 @@ __ieee754_hypotf(float x, float y)
        GET_FLOAT_WORD(hb,y);
        hb &= 0x7fffffff;
        if (ha == 0x7f800000)
-         {
-           if (x == y)
-             return fabsf(y);
-           return fabsf(x);
-         }
+         return fabsf(x);
        else if (hb == 0x7f800000)
-         {
-           if (x == y)
-             return fabsf(x);
-           return fabsf(y);
-         }
+         return fabsf(y);
        else if (ha > 0x7f800000 || hb > 0x7f800000)
          return fabsf(x) * fabsf(y);
        else if (ha == 0)