diff options
-rw-r--r-- | math/powf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/math/powf.c b/math/powf.c index 42d3e67..69a57db 100644 --- a/math/powf.c +++ b/math/powf.c @@ -182,6 +182,14 @@ powf (float x, float y) if (2 * ix == 0 && iy & 0x80000000) return __math_divzerof (sign_bias); #endif +#ifdef CLANG_EXCEPTIONS + /* Some versions of clang hoist the 1/x2 and thus division + by zero exception can be signaled spuriously, this is + not a real fix (that would require clang to model fenv + correctly), but seems to work in practice. */ + if (2 * ix == 0 && !(iy & 0x80000000)) + return x2; +#endif return iy & 0x80000000 ? 1 / x2 : x2; } /* x and y are non-zero finite. */ |