Perl / perl5

πŸͺ The Perl programming language
https://dev.perl.org/perl5/
Other
1.88k stars 531 forks source link

-0.0 printed as "0" on Windows #8046

Closed p5pRT closed 13 years ago

p5pRT commented 18 years ago

Migrated from rt.perl.org#36676 (status was 'resolved')

Searchable as RT36676$

p5pRT commented 18 years ago

From pfusik@op.pl

This is a bug report for perl from pfusik@​op.pl\, generated with the help of perlbug 1.35 running under perl v5.8.7.


ActivePerl on Windows prints or stringifies -0.0 to "0"\, rather than the expected "-0"​:

perl -le "print -0.0" 0

This is incompatible with the same version of ActivePerl on Linux.



Flags​:   category=core   severity=medium


Site configuration information for perl v5.8.7​:

Configured by builder at Mon Jun 6 13​:36​:05 2005.

Summary of my perl5 (revision 5 version 8 subversion 7) configuration​:   Platform​:   osname=MSWin32\, osvers=5.0\, archname=MSWin32-x86-multi-thread   uname=''   config_args='undef'   hint=recommended\, useposix=true\, d_sigaction=undef   usethreads=define use5005threads=undef useithreads=define usemultiplicity=define   useperlio=define d_sfio=undef uselargefiles=define usesocks=undef   use64bitint=undef use64bitall=undef uselongdouble=undef   usemymalloc=n\, bincompat5005=undef   Compiler​:   cc='cl'\, ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DBUILT_BY_ACTIVESTATE -DNO_HASH_SEED -DUSE_ SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX'\,   optimize='-MD -Zi -DNDEBUG -O1'\,   cppflags='-DWIN32'   ccversion='12.00.8804'\, gccversion=''\, gccosandvers=''   intsize=4\, longsize=4\, ptrsize=4\, doublesize=8\, byteorder=1234   d_longlong=undef\, longlongsize=8\, d_longdbl=define\, longdblsize=10   ivtype='long'\, ivsize=4\, nvtype='double'\, nvsize=8\, Off_t='__int64'\, lseeksize=8   alignbytes=8\, prototype=define   Linker and Libraries​:   ld='link'\, ldflags ='-nologo -nodefaultlib -debug -opt​:ref\,icf -libpath​:"C​:\j\Perl\lib\CORE" -machine​:x86'   libpth=\lib   libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib   perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib   libc=msvcrt.lib\, so=dll\, useshrplib=yes\, libperl=perl58.lib   gnulibc_version='undef'   Dynamic Linking​:   dlsrc=dl_win32.xs\, dlext=dll\, d_dlsymun=undef\, ccdlflags=' '   cccdlflags=' '\, lddlflags='-dll -nologo -nodefaultlib -debug -opt​:ref\,icf -libpath​:"C​:\j\Perl\lib\CORE" -machine​:x86'

Locally applied patches​:   ACTIVEPERL_LOCAL_PATCHES_ENTRY   # if !defined(PERL_DARWIN)   Iin_load_module moved for compatibility with build 806   # endif   # if defined(__hpux)   Avoid signal flag SA_RESTART for older versions of HP-UX   # endif   PerlEx hacks for CGI​::Carp   Less verbose ExtUtils​::Install and Pod​::Find   instmodsh upgraded from ExtUtils-MakeMaker-6.25   24699 ICMP_UNREACHABLE handling in Net​::Ping   21540 Fix backward-compatibility issues in if.pm


@​INC for perl v5.8.7​:   c​:/j/Perl/lib   c​:/j/Perl/site/lib   .


Environment for perl v5.8.7​:   HOME (unset)   LANG (unset)   LANGUAGE (unset)   LD_LIBRARY_PATH (unset)   LOGDIR (unset)   PATH=D​:\XPINST\system32;D​:\XPINST;D​:\XPINST\System32\Wbem;D​:\Program Files\Microsoft SQL Server\80\Tools\Binn\;c​:\u;c​:\java\jdk\bin;c​:\c\djgpp\bin;c​:\j\Perl\bin;C​:\j\mysql\bin;c​:\u\texmf\main\miktex\bin;c​:\u\gs\gs8.11\bin ;c​:\c\cygwin\bin;C​:\WINDOWS;C​:\WINDOWS\COMMAND;c​:\u\ant\bin   PERL_BADLANG (unset)   SHELL (unset)

p5pRT commented 18 years ago

From shouldbedomo@mac.com

On 2005–07–28\, at 00​:43\, Piotr Fusik (via RT) wrote​:

ActivePerl on Windows prints or stringifies -0.0 to "0"\, rather than the expected "-0"​:

perl -le "print -0.0" 0

This is incompatible with the same version of ActivePerl on Linux.

This may be related to this comment in t/op/sprintf.t​:

# The following tests are not currently run\, for the reasons stated​:

=pod

=begin problematic

%.0f\< >-0.1\< >-0\< >C library bug​: no minus on VMS\, HP-UX\< ...

Does Windows (or rather Microsoft's standard C library) have the same
issue?

What does Windows ActivePerl say for

$ perl -we 'printf "%0.f\n"\, -0.1' -0

But anyway\, as the C standard has a footnote saying "The results of
all floating conversions of a negative zero\, and of negative values
that round to zero\, include a minus sign"\, I've attached a patch for
sprintf.t that adds a test. I fully expect it to fail on a number of
platforms\, in which case it can be hoisted into the "problematic"
section. Smokers\, let me know of failures please. -- Dominic Dunlop

p5pRT commented 18 years ago

From shouldbedomo@mac.com

sprintf.t-patch

p5pRT commented 18 years ago

The RT System itself - Status changed from 'new' to 'open'

p5pRT commented 18 years ago

From pfusik@op.pl

What does Windows ActivePerl say for

$ perl -we \'printf "%0.f\\n"\, -0.1\' -0

C​:\>perl -we "printf '%0.f'\, -0.1" -0 C​:\>perl -we "printf '%0.f'\, -0.0" 0

p5pRT commented 18 years ago

From @tux

On Thu\, 28 Jul 2005 10​:55​:54 +0200\, Dominic Dunlop \shouldbedomo@&#8203;mac\.com wrote​:

On 2005–07–28\, at 00​:43\, Piotr Fusik (via RT) wrote​:

ActivePerl on Windows prints or stringifies -0.0 to "0"\, rather than the expected "-0"​:

perl -le "print -0.0" 0

This is incompatible with the same version of ActivePerl on Linux.

This may be related to this comment in t/op/sprintf.t​:

# The following tests are not currently run\, for the reasons stated​:

=pod

=begin problematic

%.0f\< >-0.1\< >-0\< >C library bug​: no minus on VMS\, HP-UX\<

Which isn't true anymore anyway. I've just tried on SuSE 9.2\, SuSE 9.3\, AIX 4.3.3\, AIX 5.2.0\, HP-UX 11i\, and HP-UX 11.00\, and all print "-0" on the example below. Only HP-UX 10.20 still prints "0"

...

Does Windows (or rather Microsoft's standard C library) have the same
issue?

What does Windows ActivePerl say for

$ perl -we 'printf "%0.f\n"\, -0.1' -0

But anyway\, as the C standard has a footnote saying "The results of
all floating conversions of a negative zero\, and of negative values
that round to zero\, include a minus sign"\, I've attached a patch for
sprintf.t that adds a test. I fully expect it to fail on a number of
platforms\, in which case it can be hoisted into the "problematic"
section. Smokers\, let me know of failures please.

And\, knowing that it fails on those platforms\, what do you want to do with it? Skip or TODO? I can assure you that no changes will be made for libc in HP-UX 11.00 or below\, so the 10.20 failure will stay there till the end of times (unless we work around it in the perl source\, which is not worth the trouble if you want my opinion)

-- H.Merijn Brand Amsterdam Perl Mongers (http​://amsterdam.pm.org/) using Perl 5.6.2\, 5.8.0\, 5.8.5\, & 5.9.2 on HP-UX 10.20\, 11.00 & 11.11\, AIX 4.3 & 5.2\, SuSE 9.2 & 9.3\, and Cygwin. http​://www.cmve.net/~merijn Smoking perl​: http​://www.test-smoke.org\, perl QA​: http​://qa.perl.org reports to​: smokers-reports@​perl.org\, perl-qa@​perl.org

p5pRT commented 18 years ago

From @nwc10

On Thu\, Jul 28\, 2005 at 11​:07​:37AM +0200\, H.Merijn Brand wrote​:

And\, knowing that it fails on those platforms\, what do you want to do with it? Skip or TODO? I can assure you that no changes will be made for libc in HP-UX 11.00 or below\, so the 10.20 failure will stay there till the end of times (unless we work around it in the perl source\, which is not worth the trouble if you want my opinion)

I think the best we can do is document it as "this isn't portable" and leave it at that. The behaviour of negative floating point zero is platform specific. For starters\, it assumes that your platform's floating point can represent it.

Heck\, there was a thread a year or two back on perl6-internals where it turned out that the precise choice of CPU instructions by the compiler on one platform affected whether a particular C construction produced positive or negative floating point zero. This was the vendor compiler\, not gcc.

Nicholas Clark

p5pRT commented 18 years ago

From @tux

On Thu\, 28 Jul 2005 10​:58​:50 +0100\, Nicholas Clark \nick@&#8203;ccl4\.org wrote​:

On Thu\, Jul 28\, 2005 at 11​:07​:37AM +0200\, H.Merijn Brand wrote​:

And\, knowing that it fails on those platforms\, what do you want to do with it? Skip or TODO? I can assure you that no changes will be made for libc in HP-UX 11.00 or below\, so the 10.20 failure will stay there till the end of times (unless we work around it in the perl source\, which is not worth the trouble if you want my opinion)

I think the best we can do is document it as "this isn't portable" and leave it at that. The behaviour of negative floating point zero is platform specific. For starters\, it assumes that your platform's floating point can represent it.

Heck\, there was a thread a year or two back on perl6-internals where it turned out that the precise choice of CPU instructions by the compiler on one platform affected whether a particular C construction produced positive or negative floating point zero. This was the vendor compiler\, not gcc.

OK\, here's my suggestion. The comments in the list of tests can now control the skip behaviour of the test. The patch enables almost all previously commented out tests\, and adds the one Dominic suggested. I have tested this on HP-UX 10.20\, HP-UX 11.00\, HP-UX 11.11\, AIX 4.3.3\, AIX 5.2\, and SuSE 9.2 & 9.3

ok 145 ok 146 ok 147 # skip No minus\, failure expected on hpux 10.20 ok 148

Inline Patch ```diff --- t/op/sprintf.t 2005-07-18 15:08:05 +0200 +++ /tmp/sprintf.t 2005-07-28 12:21:22 +0200 @@ -11,8 +11,7 @@ BEGIN { @INC = '../lib'; } use warnings; -# we do not load %Config since this test resides in op and needs -# to run under the minitest target even without Config.pm working. +use Config; # strictness my @tests = (); @@ -85,9 +84,24 @@ for ($i = 1; @tests; $i++) { } } + my $skip = 0; + if ($comment =~ s/\s+skip:\s*(.*)//) { + my $os = $1; + if ($os =~ /\ball\b/i) { # >comment skip: all< + $skip = 1; + } elsif ($os =~ /\b$^O(?::(\S+))?\b/i) { # >comment skip: VMS hpux:10.20< + (my $vsn = $1 // "") =~ s/^(\d+(\.\d+)?).*/$1/; + $vsn && $Config{osvers} <= $vsn and $skip = 1; + } + $skip and $comment =~ s/$/, failure expected on $^O $Config{osvers}/; + } + if ($x eq ">$result<") { print "ok $i\n"; } + elsif ($skip) { + print "ok $i # skip $comment\n"; + } elsif ($y eq ">$result<") # Some C libraries always give { # three-digit exponent print("ok $i # >$result< $x three-digit exponent accepted\n"); @@ -125,15 +139,8 @@ for ($i = 1; @tests; $i++) { =begin problematic ->%.0f< >-0.1< >-0< >C library bug: no minus on VMS, HP-UX< >%.0f< >1.5< >2< >Standard vague: no rounding rules< >%.0f< >2.5< >2< >Standard vague: no rounding rules< ->%G< >1234567e96< >1.23457E+102< >exponent too big for OS/390< ->%G< >.1234567e-101< >1.23457E-102< >exponent too small for OS/390< ->%e< >1234567E96< >1.234567e+102< >exponent too big for OS/390< ->%e< >.1234567E-101< >1.234567e-102< >exponent too small for OS/390< ->%g< >.1234567E-101< >1.23457e-102< >exponent too small for OS/390< ->%g< >1234567E96< >1.23457e+102< >exponent too big for OS/390< =end problematic @@ -154,6 +161,8 @@ __END__ >%G< >1234567e96< >1.23457E+102< >%G< >.1234567e-101< >1.23457E-102< >%G< >12345.6789< >12345.7< +>%G< >1234567e96< >1.23457E+102< >exponent too big skip: os390< +>%G< >.1234567e-101< >1.23457E-102< >exponent too small skip: os390< >%H< >''< >%H INVALID< >%I< >''< >%I INVALID< >%J< >''< >%J INVALID< @@ -250,6 +259,8 @@ __END__ >%+12.4e< >1234.875< > +1.2349e+03< >%+-12.4e< >-1234.875< >-1.2349e+03 < >%+12.4e< >-1234.875< > -1.2349e+03< +>%e< >1234567E96< >1.234567e+102< >exponent too big skip: os390< +>%e< >.1234567E-101< >1.234567e-102< >exponent too small skip: os390< >%f< >1234.875< >1234.875000< >%+f< >1234.875< >+1234.875000< >%#f< >1234.875< >1234.875000< @@ -258,6 +269,7 @@ __END__ >%#f< >-1234.875< >-1234.875000< >%6f< >1234.875< >1234.875000< >%*f< >[6, 1234.875]< >1234.875000< +>%.0f< >-0.1< >-0< >C library bug: no minus skip: VMS< >%.0f< >1234.875< >1235< >%.1f< >1234.875< >1234.9< >%-8.1f< >1234.875< >1234.9 < @@ -282,6 +294,7 @@ __END__ >%g< >12345.6789< >12345.7< >%+g< >12345.6789< >+12345.7< >%#g< >12345.6789< >12345.7< +>%.0g< >-0.0< >-0< >No minus skip: VMS hpux:10.20< >%.0g< >12345.6789< >1e+04< >%#.0g< >12345.6789< >1.e+04< >%.2g< >12345.6789< >1.2e+04< @@ -307,8 +320,10 @@ __END__ >%g< >0< >0< >%13g< >1234567.89< > 1.23457e+06< >%+13g< >1234567.89< > +1.23457e+06< ->%013g< >1234567.89< >001.23457e+06< ->%-13g< >1234567.89< >1.23457e+06 < +>%013g< >1234567.89< >001.23457e+06< +>%-13g< >1234567.89< >1.23457e+06 < +>%g< >.1234567E-101< >1.23457e-102< >exponent too small skip: os390< +>%g< >1234567E96< >1.23457e+102< >exponent too big skip: os390< >%h< >''< >%h INVALID< >%i< >123456.789< >123456< >Synonym for %d< >%j< >''< >%j INVALID< -- ```

H.Merijn Brand Amsterdam Perl Mongers (http​://amsterdam.pm.org/) using Perl 5.6.2\, 5.8.0\, 5.8.5\, & 5.9.2 on HP-UX 10.20\, 11.00 & 11.11\, AIX 4.3 & 5.2\, SuSE 9.2 & 9.3\, and Cygwin. http​://www.cmve.net/~merijn Smoking perl​: http​://www.test-smoke.org\, perl QA​: http​://qa.perl.org reports to​: smokers-reports@​perl.org\, perl-qa@​perl.org

p5pRT commented 18 years ago

From shouldbedomo@mac.com

On 2005–07–28\, at 11​:07\, H.Merijn Brand wrote​:

%.0f\< >-0.1\< >-0\< >C library bug​: no minus on VMS\,
HP-UX\<

Which isn't true anymore anyway. I've just tried on SuSE 9.2\, SuSE
9.3\, AIX 4.3.3\, AIX 5.2.0\, HP-UX 11i\, and HP-UX 11.00\, and all print
"-0" on the example below. Only HP-UX 10.20 still prints "0"

OK. Can somebody say what the situation is on (particular versions
of) VMS? -- copied to John E Malmberg in the hope of help.

But anyway\, as the C standard has a footnote saying "The results of all floating conversions of a negative zero\, and of negative values that round to zero\, include a minus sign"\, I've attached a patch for sprintf.t that adds a test. I fully expect it to fail on a number of platforms\, in which case it can be hoisted into the "problematic" section. Smokers\, let me know of failures please.

And\, knowing that it fails on those platforms\, what do you want to
do with it? Skip or TODO?

Ho hum. sprintf.t doesn't do Skip and TODO (mea culpa)\, so I'd have
to hack handling of them into the script\, or rewrite the whole thing
to use test.pl or whatever. I'll look into doing one or the other\,
but in the meantime I'd like to see the patch applied so as to get an
idea of where this test causes problems.

As to the test's disposition\, in the hope of action from the OS
vendor\, I'd like it to be a TODO where it fails\, but from what you
say\, it sounds like a Skip for HP-UX 10.20. However\, sprintf.t
currently says​:

# we do not load %Config since this test resides in op and needs # to run under the minitest target even without Config.pm working.

I think that precludes me from looking at the OS version ($Config {osvers})\, so it won't be possible to do fine-grained skipping
according to OS type and version. Well\, maybe I could attempt to use
Config\, and only do the fine-grained stuff if %Config gets defined...
Again\, I'll look into it.

I can assure you that no changes will be made for libc in HP-UX 11.00 or below\, so the 10.20 failure will stay there till the
end of times (unless we work around it in the perl source\, which is not
worth the trouble if you want my opinion)

Agreed that it's not worth the trouble. -- Dominic Dunlop

p5pRT commented 18 years ago

From @tux

On Thu\, 28 Jul 2005 12​:31​:24 +0200\, Dominic Dunlop \shouldbedomo@&#8203;mac\.com wrote​:

On 2005–07–28\, at 11​:07\, H.Merijn Brand wrote​:

%.0f\< >-0.1\< >-0\< >C library bug​: no minus on VMS\,
HP-UX\<

Which isn't true anymore anyway. I've just tried on SuSE 9.2\,
SuSE 9.3\, AIX 4.3.3\, AIX 5.2.0\, HP-UX 11i\, and HP-UX 11.00\, and all print "-0" on the example below. Only HP-UX 10.20 still prints "0"

OK. Can somebody say what the situation is on (particular versions of) VMS? -- copied to John E Malmberg in the hope of help.

But anyway\, as the C standard has a footnote saying "The results of all floating conversions of a negative zero\, and of negative values that round to zero\, include a minus sign"\, I've attached a patch for sprintf.t that adds a test. I fully expect it to fail on a number of platforms\, in which case it can be hoisted into the "problematic" section. Smokers\, let me know of failures please.

And\, knowing that it fails on those platforms\, what do you want to do with it? Skip or TODO?

Ho hum. sprintf.t doesn't do Skip and TODO (mea culpa)\, so I'd have to hack handling of them into the script\, or rewrite the whole thing

I beat you to that :)

to use test.pl or whatever. I'll look into doing one or the other\, but in the meantime I'd like to see the patch applied so as to get an idea of where this test causes problems.

I'll apply my suggestion\, which not only adds your tests\, but revalidates the problematic cases\, if noone objects to the suggested patch

As to the test's disposition\, in the hope of action from the OS vendor\, I'd like it to be a TODO where it fails\, but from what you

Adding TODO support would be possible\, but for now I only implemented skip

say\, it sounds like a Skip for HP-UX 10.20. However\, sprintf.t currently says​:

# we do not load %Config since this test resides in op and needs # to run under the minitest target even without Config.pm working.

Raphael ruled that removing the comment and using Config is OK.

I think that precludes me from looking at the OS version ($Config {osvers})\, so it won't be possible to do fine-grained skipping according to OS type and version. Well\, maybe I could attempt to use Config\, and only do the fine-grained stuff if %Config gets defined... Again\, I'll look into it.

I can assure you that no changes will be made for libc in HP-UX 11.00 or below\, so the 10.20 failure will stay there till the end of times (unless we work around it in the perl source\, which is not worth the trouble if you want my opinion)

Agreed that it's not worth the trouble.

-- H.Merijn Brand Amsterdam Perl Mongers (http​://amsterdam.pm.org/) using Perl 5.6.2\, 5.8.0\, 5.8.5\, & 5.9.2 on HP-UX 10.20\, 11.00 & 11.11\, AIX 4.3 & 5.2\, SuSE 9.2 & 9.3\, and Cygwin. http​://www.cmve.net/~merijn Smoking perl​: http​://www.test-smoke.org\, perl QA​: http​://qa.perl.org reports to​: smokers-reports@​perl.org\, perl-qa@​perl.org

p5pRT commented 18 years ago

From @rgs

H.Merijn Brand wrote​:

say\, it sounds like a Skip for HP-UX 10.20. However\, sprintf.t currently says​:

# we do not load %Config since this test resides in op and needs # to run under the minitest target even without Config.pm working.

Raphael ruled that removing the comment and using Config is OK.

Many tests under t/op use Config inconditionnally. This is not an ideal situation\, using eval { require Config; import Config } like some other do is better (and fallback to .* for $Config{osvers} in this test maybe ?) (and miniperl isn't broken that often those days)

-- A system is nothing more than the subordination of all aspects of the universe to any one such aspect.   -- Borges

p5pRT commented 18 years ago

From shouldbedomo@mac.com

On 2005–07–28\, at 12​:44\, H.Merijn Brand wrote​:

Ho hum. sprintf.t doesn't do Skip and TODO (mea culpa)\, so I'd have to hack handling of them into the script\, or rewrite the whole thing

I beat you to that :)

No objection whatever. Thanks!

say\, it sounds like a Skip for HP-UX 10.20. However\, sprintf.t currently says​:

# we do not load %Config since this test resides in op and needs # to run under the minitest target even without Config.pm working.

Raphael ruled that removing the comment and using Config is OK.

I put this in back in 2000 because I knew from experience of keeping
perl running on a balky platform that there's a bootstrap problem if
you can't build a miniperl that's good enough to create Config.pm and
its lack prevents you from running tests.

On 2005–07–28\, at 12​:52\, Rafael Garcia-Suarez wrote​:

Many tests under t/op use Config inconditionnally.

20 of them -- or 21 now. I think I'll file my cause under "Lost". -- Dominic Dunlop

p5pRT commented 18 years ago

From @tux

On Thu\, 28 Jul 2005 12​:52​:01 +0200\, Rafael Garcia-Suarez \rgarciasuarez@&#8203;mandriva\.com wrote​:

H.Merijn Brand wrote​:

say\, it sounds like a Skip for HP-UX 10.20. However\, sprintf.t currently says​:

# we do not load %Config since this test resides in op and needs # to run under the minitest target even without Config.pm working.

Raphael ruled that removing the comment and using Config is OK.

Many tests under t/op use Config inconditionnally. This is not an ideal situation\, using eval { require Config; import Config } like some other do is better (and fallback to .* for $Config{osvers} in this test maybe ?) (and miniperl isn't broken that often those days)

* I've changed the define-or to ?​: in the final patch to easy   integration to maint * I've added a piece of comment just before the list * I've added the special 'all' tag * I've defaulted $Config{osvers} to "0' * I've deleted some trailing whitespace * I've added a optional semicolon * I've committed the thing in change #25235

Please rsync\, test and pray

-- H.Merijn Brand Amsterdam Perl Mongers (http​://amsterdam.pm.org/) using Perl 5.6.2\, 5.8.0\, 5.8.5\, & 5.9.2 on HP-UX 10.20\, 11.00 & 11.11\, AIX 4.3 & 5.2\, SuSE 9.2 & 9.3\, and Cygwin. http​://www.cmve.net/~merijn Smoking perl​: http​://www.test-smoke.org\, perl QA​: http​://qa.perl.org reports to​: smokers-reports@​perl.org\, perl-qa@​perl.org

p5pRT commented 18 years ago

From shouldbedomo@mac.com

On 2005–07–28\, at 14​:52\, H.Merijn Brand wrote​:

Please rsync\, test and pray

Works for me. And I wasn't even praying. -- Dominic Dunlop

p5pRT commented 18 years ago

From abe@ztreet.demon.nl

Op een mooie zomerdag (Thursday 28 July 2005 12​:31)\,schreef Dominic Dunlop​:

On 2005–07–28\, at 11​:07\, H.Merijn Brand wrote​:

%.0f\< >-0.1\< >-0\< >C library bug​: no minus on VMS\, HP-UX\<

Which isn't true anymore anyway. I've just tried on SuSE 9.2\, SuSE 9.3\, AIX 4.3.3\, AIX 5.2.0\, HP-UX 11i\, and HP-UX 11.00\, and all print "-0" on the example below. Only HP-UX 10.20 still prints "0"

OK. Can somebody say what the situation is on (particular versions of) VMS? -- copied to John E Malmberg in the hope of help.

$This is perl\, v5.8.6 built for VMS_AXP $ uname -a OpenVMS SPE180 0 V8.2 AlphaServer_DS20_500_MHz Alpha $ perl -we "printf qq/%0.f\n/\, -0.1" 0

This is perl\, v5.8.6 built for VMS_VAX TIMMERMAN​:FAFNER$ uname -a OpenVMS FAFNER 0 V7.2 VAX_7000-720 VAX $ perl -we "printf qq/%0.f\n/\, -0.1" 0

HTH + Good luck\,

Abe -- Traditionally\, we accept US or UK spelling everywhere. Life's too short to ask British English speakers to learn American\, or vice versa.   -- Hugo van der Sanden on p5p @​ 2002-05-27

p5pRT commented 18 years ago

From shouldbedomo@mac.com

On 2005–07–29\, at 12​:30\, Abe Timmerman wrote​:

$This is perl\, v5.8.6 built for VMS_AXP $ uname -a OpenVMS SPE180 0 V8.2 AlphaServer_DS20_500_MHz Alpha $ perl -we "printf qq/%0.f\n/\, -0.1" 0

This is perl\, v5.8.6 built for VMS_VAX TIMMERMAN​:FAFNER$ uname -a OpenVMS FAFNER 0 V7.2 VAX_7000-720 VAX $ perl -we "printf qq/%0.f\n/\, -0.1" 0

HTH +

Indeed it does. Thanks. AFAICT from HP's site\, OpenVMS V8.2 is
current\, while V7.2 dates from 1999. Am I correct? If I am\, t/op/ sprintf.t can stay in its post-patch 25235 state\, which expects all
versions to fail this particular test. -- Dominic Dunlop

p5pRT commented 18 years ago

From @wb8tyw

Abe Timmerman wrote​:

Op een mooie zomerdag (Thursday 28 July 2005 12​:31)\,schreef Dominic Dunlop​:

On 2005–07–28\, at 11​:07\, H.Merijn Brand wrote​:

%.0f\< >-0.1\< >-0\< >C library bug​: no minus on VMS\, HP-UX\<

Which isn't true anymore anyway. I've just tried on SuSE 9.2\, SuSE 9.3\, AIX 4.3.3\, AIX 5.2.0\, HP-UX 11i\, and HP-UX 11.00\, and all print "-0" on the example below. Only HP-UX 10.20 still prints "0"

OK. Can somebody say what the situation is on (particular versions of) VMS? -- copied to John E Malmberg in the hope of help.

$This is perl\, v5.8.6 built for VMS_AXP $ uname -a OpenVMS SPE180 0 V8.2 AlphaServer_DS20_500_MHz Alpha $ perl -we "printf qq/%0.f\n/\, -0.1" 0

This is perl\, v5.8.6 built for VMS_VAX TIMMERMAN​:FAFNER$ uname -a OpenVMS FAFNER 0 V7.2 VAX_7000-720 VAX $ perl -we "printf qq/%0.f\n/\, -0.1" 0

I will pass this on to the experts in this area. It may be a case of setting the proper build options.

Some bug-fixes that visibly change behavior are not enabled by default so that they do not break existing programs that depend on the incorrect behavior.

-John wb8tyw@​qsl.net Personal Opinion Only

p5pRT commented 18 years ago

From @wb8tyw

Dominic Dunlop wrote​:

But anyway\, as the C standard has a footnote saying "The results of all floating conversions of a negative zero\, and of negative values that round to zero\, include a minus sign"

I just got the word back from the HP VMS C experts in that area.

Specifically the cited reference is in the C99 standard and the drafts leading up to it\, but is not in the C90 standard.

At this time the OpenVMS C library and compiler are not fully compliant with the final C99 standard. Some C99 features can be optionally enabled at build time\, but this is not one of them.

Unless Perl is going to require strict compliance with C99\, then the results of this test are going to be implementation specific.

It may be useful to change the comments and or print outs on the test to indicate this.

-John wb8tyw@​qsl.net Personal Opinion Only

p5pRT commented 13 years ago

From @cpansprout

As of perl 5.14.0\, -0.0 is stringified consistently as "0" on all platforms.

So\, no\, it’s not what the original poster expected\, but it’s consistent now. (It also round-trips properly as a boolean\, which it used not to do on "-0" systems.)

p5pRT commented 13 years ago

@cpansprout - Status changed from 'open' to 'resolved'