diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-08-17 00:04:32 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-08-17 00:04:32 +0000 |
commit | 8af02333c93343b2ed2e522e4fa455023e6cc339 (patch) | |
tree | 439327e5d77a9efc207b432c12e3421097a6ecfa | |
parent | 68a29c53b68ed5d3196e36d984ad46cc171fe95a (diff) | |
download | perl-8af02333c93343b2ed2e522e4fa455023e6cc339.tar.gz |
Retract #6645.
p4raw-id: //depot/perl@6660
-rwxr-xr-x | Configure | 32 | ||||
-rw-r--r-- | Porting/Glossary | 5 | ||||
-rw-r--r-- | Porting/config.sh | 5 | ||||
-rw-r--r-- | Porting/config_H | 9 | ||||
-rw-r--r-- | config_h.SH | 7 | ||||
-rw-r--r-- | pod/perldelta.pod | 31 | ||||
-rw-r--r-- | sv.c | 32 | ||||
-rwxr-xr-x | t/op/sprintf.t | 5 |
8 files changed, 6 insertions, 120 deletions
@@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $ # -# Generated on Wed Aug 16 02:10:47 EET DST 2000 [metaconfig 3.0 PL70] +# Generated on Thu Aug 17 02:52:39 EET DST 2000 [metaconfig 3.0 PL70] # (with additional metaconfig patches by perlbug@perl.com) cat >/tmp/c1$$ <<EOF @@ -455,7 +455,6 @@ d_pause='' d_pipe='' d_poll='' d_portable='' -d_printf_exp_digits='' d_old_pthread_create_joinable='' old_pthread_create_joinable='' d_pthread_yield='' @@ -10480,34 +10479,6 @@ eval $inlibc set poll d_poll eval $inlibc -echo " " -echo "Checking how many exponent digits your sprintf formats use..." -$cat >try.c <<'EOSC' -#include <stdio.h> -int main() { - char b[10]; - exit(sprintf(b, "%0.1e", 1.2) - 5); -} -EOSC -set try -if eval $compile; then - ./try$_exe - case "$?" in - 2|3) d_printf_exp_digits=$? ;; - esac -fi -case "$d_printf_exp_digits" in -2|3) echo "Your sprintf seems to use $d_printf_exp_digits exponent digits." - ;; -*) cat <<EOM >&4 -I do not understand what your sprintf is saying. -I'm guessing it uses at least 2 exponent digits. -EOM - d_printf_exp_digits=2 - ;; -esac -$rm -f try try.* - : see whether the various POSIXish _yields exist $cat >try.c <<EOP @@ -15571,7 +15542,6 @@ d_phostname='$d_phostname' d_pipe='$d_pipe' d_poll='$d_poll' d_portable='$d_portable' -d_printf_exp_digits='$d_printf_exp_digits' d_pthread_yield='$d_pthread_yield' d_pwage='$d_pwage' d_pwchange='$d_pwchange' diff --git a/Porting/Glossary b/Porting/Glossary index 8099ea2ae7..f289baa41c 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -1118,11 +1118,6 @@ d_PRIi64 (quadfio.U): This variable conditionally defines the PERL_PRIi64 symbol, which indiciates that stdio has a symbol to print 64-bit decimal numbers. -d_printf_exp_digits (d_printfed.U): - This symbol's value is either 2 or 3, corresponding to the - number of exponent digits produced by the system's sprintf %[FGfg] - formats when the modulus of the exponent is 99 or less. - d_PRIo64 (quadfio.U): This variable conditionally defines the PERL_PRIo64 symbol, which indiciates that stdio has a symbol to print 64-bit octal numbers. diff --git a/Porting/config.sh b/Porting/config.sh index 1d7e0d5141..a6c619f6fd 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -8,7 +8,7 @@ # Package name : perl5 # Source directory : /m/fs/work/work/permanent/perl/pp4/perl -# Configuration time: Wed Aug 16 02:27:51 EET DST 2000 +# Configuration time: Thu Aug 17 02:55:55 EET DST 2000 # Configured by : jhi # Target system : osf1 alpha.hut.fi v4.0 878 alpha @@ -60,7 +60,7 @@ ccflags_uselargefiles='' ccsymbols='__alpha=1 __LANGUAGE_C__=1 __osf__=1 __unix__=1 _LONGLONG=1 _SYSTYPE_BSD=1 SYSTYPE_BSD=1 unix=1' cf_by='jhi' cf_email='yourname@yourhost.yourplace.com' -cf_time='Wed Aug 16 02:27:51 EET DST 2000' +cf_time='Thu Aug 17 02:55:55 EET DST 2000' charsize='1' chgrp='' chmod='' @@ -260,7 +260,6 @@ d_phostname='undef' d_pipe='define' d_poll='define' d_portable='define' -d_printf_exp_digits='2' d_pthread_yield='undef' d_pwage='undef' d_pwchange='undef' diff --git a/Porting/config_H b/Porting/config_H index dddfdda925..88e796716f 100644 --- a/Porting/config_H +++ b/Porting/config_H @@ -17,7 +17,7 @@ /* * Package name : perl5 * Source directory : /m/fs/work/work/permanent/perl/pp4/perl - * Configuration time: Wed Aug 16 02:27:51 EET DST 2000 + * Configuration time: Thu Aug 17 02:55:55 EET DST 2000 * Configured by : jhi * Target system : osf1 alpha.hut.fi v4.0 878 alpha */ @@ -3136,13 +3136,6 @@ #define PERL_XS_APIVERSION "5.7.0" #define PERL_PM_APIVERSION "5.005" -/* PRINTF_EXP_DIGITS: - * This symbol's value is either 2 or 3, corresponding to the - * number of exponent digits produced by the system's sprintf %[FGfg] - * formats when the modulus of the exponent is 99 or less. - */ -#define PRINTF_EXP_DIGITS 2 - /* I_LIBUTIL: * This symbol, if defined, indicates that <libutil.h> exists and * should be included. diff --git a/config_h.SH b/config_h.SH index 209c96ff66..e66e0c5ed0 100644 --- a/config_h.SH +++ b/config_h.SH @@ -3156,13 +3156,6 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un #define PERL_XS_APIVERSION "$xs_apiversion" #define PERL_PM_APIVERSION "$pm_apiversion" -/* PRINTF_EXP_DIGITS: - * This symbol's value is either 2 or 3, corresponding to the - * number of exponent digits produced by the system's sprintf %[FGfg] - * formats when the modulus of the exponent is 99 or less. - */ -#define PRINTF_EXP_DIGITS $d_printf_exp_digits - /* I_LIBUTIL: * This symbol, if defined, indicates that <libutil.h> exists and * should be included. diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 45b2f8ede2..9afa44d27d 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -27,37 +27,6 @@ to be the case and the 'cc' does not seem to be the GNU C compiler =head1 Platform specific changes -=head2 printf() and sprintf() give two-digit exponent where possible - -Perl's printf() and sprintf() use the standard C library sprintf() -function to implement the floating point conversions provided by the -C<%e>, C<%f> and C<%g> formats (and their upper-case counterparts). C -library sprintf() functions vary in the number of exponent digits that -they produce in scientific notation when the modulus of the exponent -is less than one hundred: most platforms give two digits (for example, -C<1.234e-45>) while others, notably Microsoft's libraries for Windows, -give three (as in C<1.234e-045>). Previously, Perl's functions -produced results identical to the platform's underlying library -function, resulting in script portability problems. Now, on all -platforms, only two exponent digits are delivered unless more are -needed. - -Note that this change applies only to explicit conversions made by -printf() and sprintf(); implicit conversions still show the same -behavior as the underlying library function: - - print "native: ", 1234567e89, sprintf("; standardized: %e\n", 1234567e89) - -outputs - - native: 1.234567e+95; standardized: 1.234567e+95 - -on most platforms, and - - native: 1.234567e+095; standardized: 1.234567e+95 - -on the remainder. - =head1 Significant bug fixes =head1 New or Changed Diagnostics @@ -6561,38 +6561,9 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV (void)sprintf(PL_efloatbuf, eptr, nv); RESTORE_NUMERIC_STANDARD(); } + eptr = PL_efloatbuf; elen = strlen(PL_efloatbuf); - -#if PRINTF_EXP_DIGITS == 3 /* Shorten exponent */ - if (((p = index(eptr, 'e')) || (p = index(eptr, 'E'))) && - (*++p == '+' || *p == '-') && /* Is there exponent */ - *++p == '0') { /* with leading zero? */ - DEBUG_c(PerlIO_printf(Perl_debug_log, - ">%s<: '0' at %d from start; " - "elen == %d, width == %d\n", - eptr, p-eptr, elen, width)); - Move(p+1, p, 3, char); /* Suppress leading zero */ - if (elen == width && /* Fix up padding if */ - *(p+2) == '\0') { /* necessary */ - if (!left) { - if (fill == '0') { - Move(eptr+1, eptr+2, elen-1, char); - *(eptr+1) = '0'; - } - else { - Move(eptr, eptr+1, elen, char); - *eptr = ' '; - } - } - else { - *(p+2) == ' '; *(p+3) = '\0'; - } - } - else if (elen > width) - elen--; - } -# endif break; /* SPECIAL */ @@ -8374,3 +8345,4 @@ do_clean_all(pTHXo_ SV *sv) SvFLAGS(sv) |= SVf_BREAK; SvREFCNT_dec(sv); } + diff --git a/t/op/sprintf.t b/t/op/sprintf.t index e96c6830ba..8bb75365dd 100755 --- a/t/op/sprintf.t +++ b/t/op/sprintf.t @@ -197,10 +197,8 @@ __END__ >%12.4e< >1234.875< > 1.2349e+03< >%+-12.4e< >1234.875< >+1.2349e+03 < >%+12.4e< >1234.875< > +1.2349e+03< ->%+012.4e< >1234.875< >+01.2349e+03< >%+-12.4e< >-1234.875< >-1.2349e+03 < >%+12.4e< >-1234.875< > -1.2349e+03< ->%+012.4e< >-1234.875< >-01.2349e+03< >%f< >1234.875< >1234.875000< >%+f< >1234.875< >+1234.875000< >%#f< >1234.875< >1234.875000< @@ -215,10 +213,8 @@ __END__ >%8.1f< >1234.875< > 1234.9< >%+-8.1f< >1234.875< >+1234.9 < >%+8.1f< >1234.875< > +1234.9< ->%+08.1f< >1234.875< >+01234.9< >%+-8.1f< >-1234.875< >-1234.9 < >%+8.1f< >-1234.875< > -1234.9< ->%+08.1f< >-1234.875< >-01234.9< >%*.*f< >[5, 2, 12.3456]< >12.35< >%f< >0< >0.000000< >%.0f< >0< >0< @@ -256,7 +252,6 @@ __END__ >%g< >0< >0< >%13g< >1234567.89< > 1.23457e+06< >%+13g< >1234567.89< > +1.23457e+06< ->%+013g< >1234567.89< >+01.23457e+06< >%013g< >1234567.89< >001.23457e+06< >%-13g< >1234567.89< >1.23457e+06 < >%h< >''< >%h INVALID< |