diff options
Diffstat (limited to 'sysdeps/ieee754/flt-32/e_hypotf.c')
-rw-r--r-- | sysdeps/ieee754/flt-32/e_hypotf.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sysdeps/ieee754/flt-32/e_hypotf.c b/sysdeps/ieee754/flt-32/e_hypotf.c index 323cbb0cd0..1d79d35797 100644 --- a/sysdeps/ieee754/flt-32/e_hypotf.c +++ b/sysdeps/ieee754/flt-32/e_hypotf.c @@ -16,13 +16,16 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ +#include <errno.h> #include <libm-alias-finite.h> +#include <libm-alias-float.h> +#include <math-svid-compat.h> #include <math.h> #include <math-narrow-eval.h> #include <math_private.h> float -__ieee754_hypotf (float x, float y) +__hypotf (float x, float y) { if (!isfinite (x) || !isfinite (y)) { @@ -32,9 +35,17 @@ __ieee754_hypotf (float x, float y) return x + y; } - return math_narrow_eval ((float) sqrt ((double) x * (double) x - + (double) y * (double) y)); + float r = math_narrow_eval ((float) sqrt ((double) x * (double) x + + (double) y * (double) y)); + if (!isfinite (r)) + __set_errno (ERANGE); + return r; } -#ifndef __ieee754_hypotf -libm_alias_finite (__ieee754_hypotf, __hypotf) +strong_alias (__hypotf, __ieee754_hypotf) +#if LIBM_SVID_COMPAT +versioned_symbol (libm, __hypotf, hypotf, GLIBC_2_35); +libm_alias_float_other (__hypot, hypot) +#else +libm_alias_float (__hypot, hypot) #endif +libm_alias_finite (__ieee754_hypotf, __hypotf) |