Fix three more flaky tests: igamma, tensor_random, matrix_power

libeigen/eigen!2268

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-03-08 16:00:04 -07:00
parent 8eaa7552fe
commit f80d7b8254
3 changed files with 34 additions and 9 deletions

View File

@@ -1165,7 +1165,13 @@ struct igamma_generic_impl {
}
}
return igamma_series_impl<Scalar, mode>::run(a, x);
Scalar ret = igamma_series_impl<Scalar, mode>::run(a, x);
if (mode == VALUE) {
// Clamp to [0,1] since accumulated series terms can slightly exceed 1.0
// due to floating-point rounding for extreme arguments.
return numext::mini(one, numext::maxi(zero, ret));
}
return ret;
}
};