Be inspired more by Hugo-- introduce HAS_MODFL_POW32_BUG.
authorJarkko Hietaniemi <jhi@iki.fi>
Fri, 8 Jun 2001 14:15:32 +0000 (14:15 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 8 Jun 2001 14:15:32 +0000 (14:15 +0000)
p4raw-id: //depot/perl@10479

15 files changed:
Configure
Porting/Glossary
Porting/config.sh
Porting/config_H
config_h.SH
configure.com
epoc/config.sh
pp.c
uconfig.h
uconfig.sh
vos/config.alpha.def
vos/config.ga.def
win32/config.bc
win32/config.gc
win32/config.vc

index df35742..7ba331a 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Fri Jun  8 02:03:31 EET DST 2001 [metaconfig 3.0 PL70]
+# Generated on Fri Jun  8 18:06:31 EET DST 2001 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >c1$$ <<EOF
@@ -450,6 +450,7 @@ d_mktime=''
 d_mmap=''
 mmaptype=''
 d_modfl=''
+d_modfl_pow32_bug=''
 d_mprotect=''
 d_msg=''
 d_msgctl=''
@@ -10476,6 +10477,8 @@ esac
 set modfl d_modfl
 eval $inlibc
 
+d_modfl_pow32_bug="$undef"
+
 case "$d_longdbl$d_modfl" in
 $define$define)
        $cat <<EOM
@@ -10505,7 +10508,7 @@ EOCP
                case "$foo" in
                *" 4294967303.150000 1.150000 4294967302.000000")
                        echo >&4 "Your modfl() is broken for large values."
-                       d_modfl="$undef"
+                       d_modfl_pow32_bug="$define"
                        case "$foo" in
                        glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
                        ;;
@@ -16444,6 +16447,7 @@ d_mkstemps='$d_mkstemps'
 d_mktime='$d_mktime'
 d_mmap='$d_mmap'
 d_modfl='$d_modfl'
+d_modfl_pow32_bug='$d_modfl_pow32_bug'
 d_mprotect='$d_mprotect'
 d_msg='$d_msg'
 d_msg_ctrunc='$d_msg_ctrunc'
index aef6a26..6995d08 100644 (file)
@@ -1005,6 +1005,13 @@ d_modfl (d_modfl.U):
        This variable conditionally defines the HAS_MODFL symbol, which
        indicates to the C program that the modfl() routine is available.
 
+d_modfl_pow32_bug (d_modfl.U):
+       This variable conditionally defines the HAS_MODFL_POW32_BUG symbol,
+       which indicates that modfl() is broken for long doubles >= pow(2, 32).
+       For example from 4294967303.150000 one would get 4294967302.000000
+       and 1.150000.  The bug has been seen in certain versions of glibc,
+       release 2.2.2 is known to be okay.
+
 d_mprotect (d_mprotect.U):
        This variable conditionally defines HAS_MPROTECT if mprotect() is
        available to modify the access protection of a memory mapped file.
index 51ec9c3..f225a7b 100644 (file)
@@ -8,7 +8,7 @@
 
 # Package name      : perl5
 # Source directory  : .
-# Configuration time: Fri Jun  8 04:49:05 EET DST 2001
+# Configuration time: Fri Jun  8 18:08:58 EET DST 2001
 # Configured by     : jhi
 # Target system     : osf1 alpha.hut.fi v4.0 878 alpha 
 
@@ -63,7 +63,7 @@ ccsymbols='__alpha=1 __LANGUAGE_C__=1 __osf__=1 __unix__=1 _LONGLONG=1 _SYSTYPE_
 ccversion='V5.6-082'
 cf_by='jhi'
 cf_email='yourname@yourhost.yourplace.com'
-cf_time='Fri Jun  8 04:49:05 EET DST 2001'
+cf_time='Fri Jun  8 18:08:58 EET DST 2001'
 charsize='1'
 chgrp=''
 chmod=''
@@ -243,6 +243,7 @@ d_mkstemps='undef'
 d_mktime='define'
 d_mmap='define'
 d_modfl='undef'
+d_modfl_pow32_bug='undef'
 d_mprotect='define'
 d_msg='define'
 d_msg_ctrunc='define'
@@ -669,7 +670,7 @@ patchlevel='7'
 path_sep=':'
 perl5='/u/vieraat/vieraat/jhi/Perl/bin/perl'
 perl=''
-perl_patchlevel='10438'
+perl_patchlevel='10475'
 perladmin='yourname@yourhost.yourplace.com'
 perllibs='-lm -liconv -lutil -lpthread -lexc'
 perlpath='/opt/perl/bin/perl'
@@ -864,7 +865,7 @@ PERL_SUBVERSION=1
 PERL_API_REVISION=5
 PERL_API_VERSION=5
 PERL_API_SUBVERSION=0
-PERL_PATCHLEVEL=10438
+PERL_PATCHLEVEL=10475
 PERL_CONFIG_SH=true
 # Variables propagated from previous config.sh file.
 pp_sys_cflags='ccflags="$ccflags -DNO_EFF_ONLY_OK"'
index ede0f5b..fa60e91 100644 (file)
@@ -17,7 +17,7 @@
 /*
  * Package name      : perl5
  * Source directory  : .
- * Configuration time: Fri Jun  8 04:49:05 EET DST 2001
+ * Configuration time: Fri Jun  8 18:08:58 EET DST 2001
  * Configured by     : jhi
  * Target system     : osf1 alpha.hut.fi v4.0 878 alpha 
  */
  *     available to split a long double x into a fractional part f and
  *     an integer part i such that |f| < 1.0 and (f + i) = x.
  */
+/* HAS_MODFL_POW32_BUG:
+ *     This symbol, if defined, indicates that the modfl routine is
+ *     broken for long doubles >= pow(2, 32).
+ *     For example from 4294967303.150000 one would get 4294967302.000000
+ *     and 1.150000.  The bug has been seen in certain versions of glibc,
+ *     release 2.2.2 is known to be okay.
+ */
 /*#define HAS_MODFL            / **/
+/*#define HAS_MODFL_POW32_BUG          / **/
 
 /* HAS_MPROTECT:
  *     This symbol, if defined, indicates that the mprotect system call is
index b8a2481..b3a8c7e 100644 (file)
@@ -1800,7 +1800,15 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
  *     available to split a long double x into a fractional part f and
  *     an integer part i such that |f| < 1.0 and (f + i) = x.
  */
+/* HAS_MODFL_POW32_BUG:
+ *     This symbol, if defined, indicates that the modfl routine is
+ *     broken for long doubles >= pow(2, 32).
+ *     For example from 4294967303.150000 one would get 4294967302.000000
+ *     and 1.150000.  The bug has been seen in certain versions of glibc,
+ *     release 2.2.2 is known to be okay.
+ */
 #$d_modfl HAS_MODFL            /**/
+#$d_modfl_pow32_bug HAS_MODFL_POW32_BUG                /**/
 
 /* HAS_MPROTECT:
  *     This symbol, if defined, indicates that the mprotect system call is
index aae059e..b18a1ca 100644 (file)
@@ -5124,6 +5124,7 @@ $ WC "d_mkstemps='" + d_mkstemps + "'"
 $ WC "d_mktime='" + d_mktime + "'"
 $ WC "d_mmap='undef'"
 $ WC "d_modfl='" + d_modfl + "'"
+$ WC "d_modfl_pow32_bug = "undef"'
 $ WC "d_mprotect='undef'"
 $ WC "d_msg='undef'"
 $ WC "d_msg_ctrunc='undef'"
index b2e3fe6..e9a5cd6 100644 (file)
@@ -232,6 +232,7 @@ d_mkfifo='undef'
 d_mktime='define'
 d_mmap='undef'
 d_modfl='undef'
+d_modfl_pow32_bug='undef'
 d_mprotect='undef'
 d_msg='undef'
 d_msg_ctrunc='undef'
diff --git a/pp.c b/pp.c
index a8b3e55..ebdf3fd 100644 (file)
--- 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;
index 0c788f1..7084a28 100644 (file)
--- a/uconfig.h
+++ b/uconfig.h
  *     This symbol contains the value of sizeof(short) so that the C
  *     preprocessor can make decisions based on it.
  */
-#define INTSIZE 1              /**/
+#define INTSIZE 4              /**/
 #define LONGSIZE 4             /**/
-#define SHORTSIZE 1            /**/
+#define SHORTSIZE 2            /**/
 
 /* MULTIARCH:
  *     This symbol, if defined, signifies that the build
  */
 /*#define HAS_LONG_DOUBLE              / **/
 #ifdef HAS_LONG_DOUBLE
-#define LONG_DOUBLESIZE 1              /**/
+#define LONG_DOUBLESIZE 8              /**/
 #endif
 
 /* HAS_LONG_LONG:
  */
 /*#define HAS_LONG_LONG                / **/
 #ifdef HAS_LONG_LONG
-#define LONGLONGSIZE 1         /**/
+#define LONGLONGSIZE 8         /**/
 #endif
 
 /* HAS_LSEEK_PROTO:
  *     available to split a long double x into a fractional part f and
  *     an integer part i such that |f| < 1.0 and (f + i) = x.
  */
+/* HAS_MODFL_POW32_BUG:
+ *     This symbol, if defined, indicates that the modfl routine is
+ *     broken for long doubles >= pow(2, 32).
+ *     For example from 4294967303.150000 one would get 4294967302.000000
+ *     and 1.150000.  The bug has been seen in certain versions of glibc,
+ *     release 2.2.2 is known to be okay.
+ */
 /*#define HAS_MODFL            / **/
+/*#define HAS_MODFL_POW32_BUG          / **/
 
 /* HAS_MPROTECT:
  *     This symbol, if defined, indicates that the mprotect system call is
  *     This symbol holds the number of bytes used by the Off_t.
  */
 #define Off_t int              /* <offset> type */
-#define LSEEKSIZE 1            /* <offset> size */
-#define Off_t_size 1   /* <offset> size */
+#define LSEEKSIZE 4            /* <offset> size */
+#define Off_t_size 4   /* <offset> size */
 
 /* Free_t:
  *     This variable contains the return type of free().  It is usually
 /* Size_t_size:
  *     This symbol holds the size of a Size_t in bytes.
  */
-#define Size_t_size 1          /* */
+#define Size_t_size 4          /* */
 
 /* Size_t:
  *     This symbol holds the type used to declare length parameters
index a6765d4..5fdadea 100755 (executable)
@@ -174,6 +174,7 @@ d_mkstemps='undef'
 d_mktime='undef'
 d_mmap='undef'
 d_modfl='undef'
+d_modfl_pow32_bug='undef'
 d_mprotect='undef'
 d_msg='undef'
 d_msg_ctrunc='undef'
@@ -460,15 +461,14 @@ inc_version_list_init='NULL'
 installstyle='lib/perl5'
 installusrbinperl='undef'
 intsize='4'
-intsize=1
 ivdformat='"ld"'
 ivsize='4'
 ivtype='long'
 lib_ext='.a'
-longdblsize=1
-longlongsize=1
+longdblsize=8
+longlongsize=8
 longsize='4'
-lseeksize=1
+lseeksize=4
 lseektype=int
 malloctype='int*'
 malloctype='void *'
@@ -526,12 +526,12 @@ seedfunc='srand'
 selectminbits='32'
 selecttype=int
 shmattype='void *'
-shortsize=1
+shortsize=2
 sig_name_init='0'
 sig_num_init='0'
 sig_size='1'
 signal_t=int
-sizesize=1
+sizesize=4
 sizetype=int
 socksizetype='int'
 ssizetype=int
index e532eac..18be779 100644 (file)
@@ -157,6 +157,7 @@ $d_mkstemps='undef'
 $d_mktime='define'
 $d_mmap='undef'
 $d_modfl='undef'
+$d_modfl_pow32_bug='undef'
 $d_mprotect='undef'
 $d_msg='undef'
 $d_msg_ctrunc='undef'
index 56410e2..823bdb0 100644 (file)
@@ -157,6 +157,7 @@ $d_mkstemps='undef'
 $d_mktime='define'
 $d_mmap='define'
 $d_modfl='undef'
+$d_modfl_pow32_bug='undef'
 $d_mprotect='undef'
 $d_msg='undef'
 $d_msg_ctrunc='undef'
index b8ee924..ee160fd 100644 (file)
@@ -227,6 +227,7 @@ d_mkstemps='undef'
 d_mktime='define'
 d_mmap='undef'
 d_modfl='undef'
+d_modfl_pow32_bug='undef'
 d_mprotect='undef'
 d_msg='undef'
 d_msg_ctrunc='undef'
index 61438a0..8adbe23 100644 (file)
@@ -227,6 +227,7 @@ d_mkstemps='undef'
 d_mktime='define'
 d_mmap='undef'
 d_modfl='undef'
+d_modfl_pow32_bug='undef'
 d_mprotect='undef'
 d_msg='undef'
 d_msg_ctrunc='undef'
index a7e5a1c..5a7b20d 100644 (file)
@@ -227,6 +227,7 @@ d_mkstemps='undef'
 d_mktime='define'
 d_mmap='undef'
 d_modfl='undef'
+d_modfl_pow32_bug='undef'
 d_mprotect='undef'
 d_msg='undef'
 d_msg_ctrunc='undef'