@@ -628,5 +628,7 @@ libm {
fminimum_numf64x; fminimum_numf128;
fminimum_magf64x; fminimum_magf128;
fminimum_mag_numf64x; fminimum_mag_numf128;
+ # No SVID compatible error handling.
+ hypotf; hypot;
}
}
new file mode 100644
@@ -0,0 +1,8 @@
+#include <math-type-macros-float.h>
+#undef __USE_WRAPPER_TEMPLATE
+#define __USE_WRAPPER_TEMPLATE 1
+#undef declare_mgen_alias
+#define declare_mgen_alias(a, b)
+#include <w_hypot_template.c>
+versioned_symbol (libm, __hypot, hypot, GLIBC_2_35);
+libm_alias_float_other (__hypot, hypot)
@@ -20,9 +20,9 @@
#include <libm-alias-double.h>
-#if LIBM_SVID_COMPAT
+#if LIBM_SVID_COMPAT && SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_35)
double
-__hypot (double x, double y)
+__hypot_compat (double x, double y)
{
double z = __ieee754_hypot(x,y);
if(__builtin_expect(!isfinite(z), 0)
@@ -31,5 +31,12 @@ __hypot (double x, double y)
return z;
}
-libm_alias_double (__hypot, hypot)
+compat_symbol (libm, __hypot_compat, hypot, GLIBC_2_0);
+# ifdef NO_LONG_DOUBLE
+weak_alias (__hypot_compat, hypotl)
+# endif
+# ifdef LONG_DOUBLE_COMPAT
+LONG_DOUBLE_COMPAT_CHOOSE_libm_expl (
+ compat_symbol (libm, __hypot_compat, hypotl, FIRST_VERSION_libm_hypotl), );
+# endif
#endif
new file mode 100644
@@ -0,0 +1,8 @@
+#include <math-type-macros-float.h>
+#undef __USE_WRAPPER_TEMPLATE
+#define __USE_WRAPPER_TEMPLATE 1
+#undef declare_mgen_alias
+#define declare_mgen_alias(a, b)
+#include <w_hypot_template.c>
+versioned_symbol (libm, __hypotf, hypotf, GLIBC_2_35);
+libm_alias_float_other (__hypotf, hypotf)
@@ -22,9 +22,9 @@
#include <libm-alias-float.h>
-#if LIBM_SVID_COMPAT
+#if LIBM_SVID_COMPAT && SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_35)
float
-__hypotf(float x, float y)
+__hypotf_compat (float x, float y)
{
float z = __ieee754_hypotf(x,y);
if(__builtin_expect(!isfinite(z), 0)
@@ -34,5 +34,5 @@ __hypotf(float x, float y)
return z;
}
-libm_alias_float (__hypot, hypot)
+compat_symbol (libm, __hypotf_compat, hypotf, GLIBC_2_0);
#endif
@@ -20,14 +20,17 @@
#include <math_private.h>
#include <math-underflow.h>
#include <math-narrow-eval.h>
+#include <math-svid-compat.h>
#include <libm-alias-finite.h>
+#include <libm-alias-double.h>
#include <math_config.h>
+#include <errno.h>
/* The i386 allows ot use the default excess of precision to optimize the
hypot implementation, since internal multiplication and sqrt is carried
with 80-bit FP type. */
double
-__ieee754_hypot (double x, double y)
+__hypot (double x, double y)
{
if ((isinf (x) || isinf (y))
&& !issignaling (x) && !issignaling (y))
@@ -37,6 +40,15 @@ __ieee754_hypot (double x, double y)
double r = math_narrow_eval (sqrt (x * x + y * y));
math_check_force_underflow_nonneg (r);
+ if (isinf (r))
+ __set_errno (ERANGE);
return r;
}
+strong_alias (__hypot, __ieee754_hypot)
+#if LIBM_SVID_COMPAT
+versioned_symbol (libm, __hypot, hypot, GLIBC_2_35);
libm_alias_finite (__ieee754_hypot, __hypot)
+libm_alias_double_other (__hypot, hypot)
+#else
+libm_alias_double (__hypot, hypot)
+#endif
@@ -32,7 +32,18 @@
#include <math-underflow.h>
#include <math-narrow-eval.h>
#include <libm-alias-finite.h>
+#include <libm-alias-double.h>
#include <math_config.h>
+#include <math-svid-compat.h>
+#include <errno.h>
+
+static inline double
+handle_errno (double r)
+{
+ if (isinf (r))
+ __set_errno (ERANGE);
+ return r;
+}
/* sqrt (DBL_EPSILON / 2.0) */
#define SQRT_EPS_DIV_2 0x1.6a09e667f3bcdp-27
@@ -48,7 +59,7 @@
#define SQRT_DBL_MIN 0x1p-511
double
-__ieee754_hypot (double x, double y)
+__hypot (double x, double y)
{
if ((isinf (x) || isinf (y))
&& !issignaling (x) && !issignaling (y))
@@ -68,7 +79,9 @@ __ieee754_hypot (double x, double y)
/* Widely varying operands. The DBL_MIN_THRESHOLD check is used to avoid
a spurious underflow from the multiplication. */
if (ax >= DBL_MIN_THRESHOLD && ay <= ax * SQRT_EPS_DIV_2)
- return (ay == 0.0) ? ax : math_narrow_eval (ax + DBL_TRUE_MIN);
+ return (ay == 0.0)
+ ? ax
+ : handle_errno (math_narrow_eval (ax + DBL_TRUE_MIN));
double scale = SCALE;
if (ax > SQRT_DBL_MAX)
@@ -105,8 +118,13 @@ __ieee754_hypot (double x, double y)
h -= (t1 + t2) / (2.0 * h);
h = math_narrow_eval (h * scale);
math_check_force_underflow_nonneg (h);
- return h;
+ return handle_errno (h);
}
-#ifndef __ieee754_hypot
+strong_alias (__hypot, __ieee754_hypot)
libm_alias_finite (__ieee754_hypot, __hypot)
+#if LIBM_SVID_COMPAT
+versioned_symbol (libm, __hypot, hypot, GLIBC_2_35);
+libm_alias_double_other (__hypot, hypot)
+#else
+libm_alias_double (__hypot, hypot)
#endif
new file mode 100644
@@ -0,0 +1 @@
+/* Not needed. */
@@ -19,9 +19,12 @@
#include <math.h>
#include <math_private.h>
#include <libm-alias-finite.h>
+#include <libm-alias-float.h>
+#include <math-svid-compat.h>
+#include <errno.h>
float
-__ieee754_hypotf (float x, float y)
+__hypotf (float x, float y)
{
if ((isinf (x) || isinf (y))
&& !issignaling (x) && !issignaling (y))
@@ -29,8 +32,16 @@ __ieee754_hypotf (float x, float y)
if (isnan (x) || isnan (y))
return x + y;
- return sqrt ((double) x * (double) x + (double) y * (double) y);
+ float r = 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)
new file mode 100644
@@ -0,0 +1 @@
+/* Not needed. */
@@ -1179,3 +1179,5 @@ GLIBC_2.35 fminimumf64x F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
deleted file mode 100644
deleted file mode 100644
@@ -1144,3 +1144,5 @@ GLIBC_2.35 fminimumf64x F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
@@ -1201,6 +1201,8 @@ GLIBC_2.35 fminimumf64x F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 __clog10l F
GLIBC_2.4 __finitel F
GLIBC_2.4 __fpclassifyl F
@@ -531,6 +531,8 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 _LIB_VERSION D 0x4
GLIBC_2.4 __clog10 F
GLIBC_2.4 __clog10f F
@@ -531,6 +531,8 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 _LIB_VERSION D 0x4
GLIBC_2.4 __clog10 F
GLIBC_2.4 __clog10f F
@@ -842,4 +842,6 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 exp2l F
@@ -1186,3 +1186,5 @@ GLIBC_2.35 fminimumf64x F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
@@ -531,6 +531,8 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 _LIB_VERSION D 0x4
GLIBC_2.4 __clog10 F
GLIBC_2.4 __clog10f F
@@ -882,3 +882,5 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
@@ -843,3 +843,5 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
@@ -843,3 +843,5 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
@@ -842,4 +842,6 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 exp2l F
@@ -1144,3 +1144,5 @@ GLIBC_2.35 fminimumf64x F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
@@ -843,3 +843,5 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
@@ -888,6 +888,8 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 __clog10l F
GLIBC_2.4 __finitel F
GLIBC_2.4 __fpclassifyl F
@@ -887,6 +887,8 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 __clog10l F
GLIBC_2.4 __finitel F
GLIBC_2.4 __fpclassifyl F
@@ -881,6 +881,8 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 __clog10l F
GLIBC_2.4 __finitel F
GLIBC_2.4 __fpclassifyl F
@@ -1316,3 +1316,5 @@ GLIBC_2.35 fminimumf64x F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
@@ -1145,6 +1145,8 @@ GLIBC_2.35 fminimumf64x F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 __clog10l F
GLIBC_2.4 __finitel F
GLIBC_2.4 __fpclassifyl F
@@ -1145,6 +1145,8 @@ GLIBC_2.35 fminimumf64x F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 __clog10l F
GLIBC_2.4 __finitel F
GLIBC_2.4 __fpclassifyl F
@@ -842,4 +842,6 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 exp2l F
@@ -842,4 +842,6 @@ GLIBC_2.35 fminimumf64 F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 exp2l F
@@ -1152,6 +1152,8 @@ GLIBC_2.35 fminimumf64x F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
GLIBC_2.4 __clog10l F
GLIBC_2.4 __finitel F
GLIBC_2.4 __fpclassifyl F
@@ -1144,3 +1144,5 @@ GLIBC_2.35 fminimumf64x F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
@@ -1177,3 +1177,5 @@ GLIBC_2.35 fminimumf64x F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F
@@ -1177,3 +1177,5 @@ GLIBC_2.35 fminimumf64x F
GLIBC_2.35 fminimuml F
GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
+GLIBC_2.35 hypot F
+GLIBC_2.35 hypotf F