diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-10-12 17:43:48 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2014-10-12 21:58:07 -0400 |
commit | c62e754c9aa399aa832a4bebf95b9ce8d3f119b2 (patch) | |
tree | a511241647b0edb6ae8114c2f84c66bfc41aa321 /numeric.c | |
parent | 48853916f1deeece371d9b1b11543cc6a077e916 (diff) | |
download | perl-c62e754c9aa399aa832a4bebf95b9ce8d3f119b2.tar.gz |
Tru64: S_mulexp10 overflow help.
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -1033,10 +1033,21 @@ S_mulexp10(NV value, I32 exponent) return value; #endif } +#if defined(__osf__) + /* Even with cc -ieee + ieee_set_fp_control(IEEE_TRAP_ENABLE_INV) + * Tru64 fp behavior on inf/nan is somewhat broken. Another way + * to do this would be ieee_set_fp_control(IEEE_TRAP_ENABLE_OVF) + * but that breaks another set of infnan.t tests. */ +# define FP_OVERFLOWS_TO_ZERO +#endif for (bit = 1; exponent; bit <<= 1) { if (exponent & bit) { exponent ^= bit; result *= power; +#ifdef FP_OVERFLOWS_TO_ZERO + if (result == 0) + return value < 0 ? -NV_INF : NV_INF; +#endif /* Floating point exceptions are supposed to be turned off, * but if we're obviously done, don't risk another iteration. */ |