This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4885391
)
Tru64: S_mulexp10 overflow help.
author
Jarkko Hietaniemi
<jhi@iki.fi>
Sun, 12 Oct 2014 21:43:48 +0000
(17:43 -0400)
committer
Jarkko Hietaniemi
<jhi@iki.fi>
Mon, 13 Oct 2014 01:58:07 +0000
(21:58 -0400)
numeric.c
patch
|
blob
|
blame
|
history
diff --git
a/numeric.c
b/numeric.c
index
75d348d
..
171f593
100644
(file)
--- a/
numeric.c
+++ b/
numeric.c
@@
-1033,10
+1033,21
@@
S_mulexp10(NV value, I32 exponent)
return value;
#endif
}
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;
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.
*/
/* Floating point exceptions are supposed to be turned off,
* but if we're obviously done, don't risk another iteration.
*/