[COMMITTED] math: Fix lgammaf regression on i686
Adhemerval Zanella
adhemerval.zanella@linaro.org
Fri Mar 27 17:05:14 GMT 2026
The new test from 19781c2221 triggers a failure on i686:
testing float (without inline functions)
Failure: lgamma (0x3.12be38p+120): errno set to 0, expected 34 (ERANGE)
Failure: lgamma_upward (0x3.12be38p+120): errno set to 0, expected 34 (ERANGE)
Use math_narrow_eval on the multiplication to force the expected
precision.
Checked on i686-linux-gnu.
---
sysdeps/ieee754/flt-32/e_lgammaf_r.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index 899f64667b..15aec67158 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -216,8 +216,9 @@ __lgammaf_r (float x, int *signgamp)
and does not overflow for x = 0x1.895f1cp+121 and rounding
towards zero */
float r = fmaf (x, 0x1.4d3398p+6f, 0x1.10f35ep+103f);
- if (x > 0x1.895f1cp+121f || (x == 0x1.895f1cp+121f &&
- x * 5.0f >= 0x1.ebb6e4p+123))
+ if (x > 0x1.895f1cp+121f
+ || (x == 0x1.895f1cp+121f
+ && math_narrow_eval (x * 5.0f) >= 0x1.ebb6e4p+123))
return __math_oflowf (0);
return r;
}
--
2.43.0
More information about the Libc-alpha
mailing list