summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-06-08 14:15:32 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-08 14:15:32 +0000
commite67aeab17662a70a2316911b8ee5b43fdf6f7241 (patch)
treee3eca0ad4b75893ddf06d7df92e3888695fd4454 /pp.c
parentc6966feaee0c3ed89d8fc30ec44b30cc2c61c5fc (diff)
downloadperl-e67aeab17662a70a2316911b8ee5b43fdf6f7241.tar.gz
Be inspired more by Hugo-- introduce HAS_MODFL_POW32_BUG.
p4raw-id: //depot/perl@10479
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/pp.c b/pp.c
index a8b3e55cec..ebdf3fd98d 100644
--- a/pp.c
+++ b/pp.c
@@ -2598,7 +2598,16 @@ PP(pp_int)
SETu(U_V(value));
} else {
#if defined(HAS_MODFL) || defined(LONG_DOUBLE_EQUALS_DOUBLE)
+# ifdef HAS_MODFL_POW32_BUG
+/* some versions of glibc split (i + d) into (i-1, d+1) for 2^32 <= i < 2^64 */
+ {
+ NV offset = Perl_modf(value, &value);
+ (void)Perl_modf(offset, &offset);
+ value += offset;
+ }
+# else
(void)Perl_modf(value, &value);
+# endif
#else
double tmp = (double)value;
(void)Perl_modf(tmp, &tmp);
@@ -2612,7 +2621,16 @@ PP(pp_int)
SETi(I_V(value));
} else {
#if defined(HAS_MODFL) || defined(LONG_DOUBLE_EQUALS_DOUBLE)
+# ifdef HAS_MODFL_POW32_BUG
+/* some versions of glibc split (i + d) into (i-1, d+1) for 2^32 <= i < 2^64 */
+ {
+ NV offset = Perl_modf(-value, &value);
+ (void)Perl_modf(offset, &offset);
+ value += offset;
+ }
+# else
(void)Perl_modf(-value, &value);
+# endif
value = -value;
#else
double tmp = (double)value;