summaryrefslogtreecommitdiff
path: root/pp_pack.c
diff options
context:
space:
mode:
authorSisyphus <sisyphus1@optusnet.com.au>2015-08-20 07:28:33 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2015-08-20 08:22:01 -0400
commit09b94b1f0efd8c107548a6fefcd471e9b06c2cdf (patch)
treec8b7ab367512dfe960c3382469cb228705f368fb /pp_pack.c
parent89afeb4776894908ce75f4b808087ff12a4bc7b5 (diff)
downloadperl-09b94b1f0efd8c107548a6fefcd471e9b06c2cdf.tar.gz
[perl #125669] op/pack.t failures with PPC long double (double double) builds
unpack '%65...' failures, to be more exact.
Diffstat (limited to 'pp_pack.c')
-rw-r--r--pp_pack.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/pp_pack.c b/pp_pack.c
index b1a0d851e3..8d7f1e2924 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -1767,7 +1767,18 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c
}
while (cdouble < 0.0)
cdouble += anv;
- cdouble = Perl_modf(cdouble / anv, &trouble) * anv;
+ cdouble = Perl_modf(cdouble / anv, &trouble);
+#ifdef LONGDOUBLE_DOUBLEDOUBLE
+ /* Workaround for powerpc doubledouble modfl bug:
+ * close to 1.0L and -1.0L cdouble is 0, and trouble
+ * is cdouble / anv. */
+ if (trouble != Perl_ceil(trouble)) {
+ cdouble = trouble;
+ if (cdouble > 1.0L) cdouble -= 1.0L;
+ if (cdouble < -1.0L) cdouble += 1.0L;
+ }
+#endif
+ cdouble *= anv;
sv = newSVnv(cdouble);
}
else {