summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-10-12 17:43:48 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-10-12 21:58:07 -0400
commitc62e754c9aa399aa832a4bebf95b9ce8d3f119b2 (patch)
treea511241647b0edb6ae8114c2f84c66bfc41aa321 /numeric.c
parent48853916f1deeece371d9b1b11543cc6a077e916 (diff)
downloadperl-c62e754c9aa399aa832a4bebf95b9ce8d3f119b2.tar.gz
Tru64: S_mulexp10 overflow help.
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/numeric.c b/numeric.c
index 75d348d030..171f59316b 100644
--- a/numeric.c
+++ b/numeric.c
@@ -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.
*/