[PATCH v4 16/21] math: Remove the SVID error handling from sinhf

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Fri Oct 31 13:15:34 GMT 2025



On 29/10/25 18:04, Wilco Dijkstra wrote:
> Hi Adhemerval,
> 
>        float sgn = copysignf (2.0f, x);
>        float r = math_narrow_eval (sgn * 0x1.fffffep127f);
> +      __set_errno (ERANGE);
>        return r;
> 
> Why not replace all that with return __math_uflowf (x < 0)?

We do need this for some corner cases:

Failure: sinh (-0x2.c678c4p+8): Exception "Overflow" not set
Failure: sinh (-0x2.c678c4p+8): Exception "Underflow" set
Failure: Test: sinh (-0x2.c678c4p+8)
Result:
 is:         -0.00000000e+00  -0x0.000000p+0
 should be:  -inf  -inf
Failure: sinh (-0x2.c678c8p+8): Exception "Overflow" not set
Failure: sinh (-0x2.c678c8p+8): Exception "Underflow" set
Failure: Test: sinh (-0x2.c678c8p+8)
Result:
 is:         -0.00000000e+00  -0x0.000000p+0
 should be:  -inf  -inf
[...]

We can simplify with:

  float sgn = copysignf (2.0f, x);
  return __math_oflowf_value (sgn * 0x1.fffffep127f);



More information about the Libc-alpha mailing list