Front page | perl.perl5.porters |
Postings from May 2001
Re: sprintf and SFIO
Thread Previous
|
Thread Next
From:
Nicholas Clark
Date:
May 3, 2001 12:51
Subject:
Re: sprintf and SFIO
Message ID:
20010503205035.A854@Bagpuss.unfortu.net
On Fri, Apr 27, 2001 at 11:34:38AM -0400, Chris Nandor wrote:
> In op/sprintf.t, there are four tests that have problems for me (with
> MacPerl 5.6.1a1).
>
> >%.0f< >0.6< >1< >Known to fail with sfio and
> >(irix|nonstop-ux|powerux)<
> >%.0f< >-0.6< >-1< >Known to fail with sfio and
> >(irix|nonstop-ux|powerux)<
> >%012.9g< >12345.6789< >0012345.6789<
> >%013g< >1234567.89< >001.23457e+06<
>
> The first two, as stated above, are known to fail with SFIO (1999). The
> other two have no such comments.
>
> The results are as follows:
>
> 0
> -0
> 12345.6789
> 1.23457e+06
>
> So questions:
>
> * Does anyone else see the problems with %g and SFIO? I could find no
> mention of them as problems elsewhere.
> * Do these problems still show up in SFIO 2000?
on linux (ARM) with this:
#include <sfio.h>
int main () {
char buffer[256];
sfsprintf (buffer, 256, ">%.0f<\n", 0.6);
write (1, buffer, strlen (buffer));
sfsprintf (buffer, 256, ">%.0f<\n", -0.6);
write (1, buffer, strlen (buffer));
sfsprintf (buffer, 256, ">%012.9g<\n", 12345.6789);
write (1, buffer, strlen (buffer));
sfsprintf (buffer, 256, ">%013g<\n", 1234567.89);
write (1, buffer, strlen (buffer));
return 0;
}
I see:
sfio97: Debian sfio1999: sfio2000:
>1< >0< >0<
>-1< >-0< >-0<
> 12345.6789< >0012345.6789< >0012345.6789<
> 1.23457e+06< >001.23457e+06< >001.23457e+06<
[sorry, no sfio98 at home, and my sfio1999 is the Debian distribution, so may
well have patches applied by the Debian packager. It says
#define SFIO_VERSION 19990805L
but it may well differ from a vanilla 19990805]
with -Dsfsprintf=snprintf glibc's stdio gives me
>1<
>-1<
>0012345.6789<
>001.23457e+06<
I hope that this is helpful. Sorry that I don't have a 98 or vanilla 1999
here. [I got sfio95 to build on Debian x86, but it fails a lot of tests]
Do we have an ANSI floating point printf lawyer to say whether perl's tests
are 100% correct? Or if sfio and irix... are acceptable in whatever they do?
Nicholas Clark
Thread Previous
|
Thread Next