summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-04-15 14:09:31 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-04-15 14:09:31 +0000
commit55954f198635e48806cb76596014125260048264 (patch)
tree57f230c6482158594af0bede2ecaae0eb028f13a /pp.c
parentfb189484f11842c8d45ba7469f6c64347beeadf3 (diff)
downloadperl-55954f198635e48806cb76596014125260048264.tar.gz
Big patch from Alan Burlison to make Solaris long doubles work.
(Also spreads more <stdlib.h> joy.) Needs backporting to metaconfig units and introducing the new symbols to non-Configure lands. p4raw-id: //depot/perl@19218
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c47
1 files changed, 15 insertions, 32 deletions
diff --git a/pp.c b/pp.c
index fde8b127df..124376687d 100644
--- a/pp.c
+++ b/pp.c
@@ -2890,24 +2890,14 @@ PP(pp_int)
SETu(U_V(value));
} else {
#if defined(SPARC64_MODF_WORKAROUND)
- (void)sparc64_workaround_modf(value, &value);
-#else
-# if defined(HAS_MODFL) || defined(LONG_DOUBLE_EQUALS_DOUBLE)
-# ifdef HAS_MODFL_POW32_BUG
+ (void)sparc64_workaround_modf(value, &value);
+#elif defined(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);
- value = (NV)tmp;
-# endif
+ NV offset = Perl_modf(value, &value);
+ (void)Perl_modf(offset, &offset);
+ value += offset;
+#else
+ (void)Perl_modf(value, &value);
#endif
SETn(value);
}
@@ -2916,24 +2906,17 @@ PP(pp_int)
if (value > (NV)IV_MIN - 0.5) {
SETi(I_V(value));
} else {
-#if defined(HAS_MODFL) || defined(LONG_DOUBLE_EQUALS_DOUBLE)
-# ifdef HAS_MODFL_POW32_BUG
+#if defined(SPARC64_MODF_WORKAROUND)
+ (void)sparc64_workaround_modf(-value, &value);
+#elif defined(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;
+ NV offset = Perl_modf(-value, &value);
+ (void)Perl_modf(offset, &offset);
+ value += offset;
#else
- double tmp = (double)value;
- (void)Perl_modf(-tmp, &tmp);
- value = -(NV)tmp;
+ (void)Perl_modf(-value, &value);
#endif
- SETn(value);
+ SETn(-value);
}
}
}