mirror of
https://github.com/ml-explore/mlx.git
synced 2025-09-20 12:08:14 +08:00
Fix overflow / underflow handling for expm1f (#1278)
* Fix overflow / underflow handling for expm1f * update tests
This commit is contained in:
@@ -83,6 +83,7 @@ float expm1f(float a) {
|
||||
r = expm1f_scaled_unchecked(a, 1.0f);
|
||||
/* handle severe overflow and underflow */
|
||||
if (abs(a - 1.0f) > 88.0f) {
|
||||
r = pow(2, a);
|
||||
r = fma(r, r, -1.0f);
|
||||
}
|
||||
return r;
|
||||
|
Reference in New Issue
Block a user