This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Simplify hypotf infinity handling (bug 15918) [committed]
- From: Joseph Myers <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Tue, 15 Sep 2015 17:25:06 +0000
- Subject: Simplify hypotf infinity handling (bug 15918) [committed]
- Authentication-results: sourceware.org; auth=none
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. Committed.
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.
diff --git a/sysdeps/ieee754/flt-32/e_hypotf.c b/sysdeps/ieee754/flt-32/e_hypotf.c
index 8f499b5..717b82e 100644
--- a/sysdeps/ieee754/flt-32/e_hypotf.c
+++ b/sysdeps/ieee754/flt-32/e_hypotf.c
@@ -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)
--
Joseph S. Myers
joseph@codesourcery.com