[PATCH v2 8/9] i386: Move hypot implementation to C

Adhemerval Zanella adhemerval.zanella@linaro.org
Mon Nov 1 17:09:17 GMT 2021



On 28/10/2021 10:43, Wilco Dijkstra wrote:
> Hi Adhemerval,
> 
> +double
> +__ieee754_hypot (double x, double y)
> +{
> +  if ((isinf (x) || isinf (y))
> +      && !issignaling (x) && !issignaling (y))
> +    return INFINITY;
> +  if (isnan (x) || isnan (y))
> +    return x + y;
> +
> +  long double lx = x;
> +  long double ly = y;
> +  double r = math_narrow_eval (sqrtl (lx * lx + ly * ly));
> +  math_check_force_underflow_nonneg (r);
> +  return r;
> +}
> 
> This looks very generic, so wouldn't it be possible to move to
> sysdeps/ieee754/ldbl-96?

I am not sure this does make sense since ldbl-96 only contains
symbols related to 'long double' and adding symbols for other
floating point types is not the best code organization imho.

Another reason is it really dependable of the underlying hardware,
since 'long double' might be implemented with software emulation
and using float/double operation might yield better performance.


More information about the Libc-alpha mailing list