|
List Info
Thread: sprintf %f panics with NaN
|
|
| sprintf %f panics with NaN |

|
2007-09-11 17:22:23 |
# New Ticket Created by Zefram
# Please include the string: [perl #45383]
# in the subject line of all future correspondence about
this issue.
# <URL: h
ttp://rt.perl.org/rt3/Ticket/Display.html?id=45383 >
This is a bug report for perl from zefram fysh.org,
generated with the help of perlbug 1.35 running under perl
v5.8.8.
------------------------------------------------------------
-----
[Please enter your report here]
On NetBSD, frexp() produces silly results if given a NaN
argument.
The effect on Perl is that sprintf with "%f"
format and a NaN argument
gives the "panic: frexp" diagnostic. NaN is a
special case that doesn't
need any frexp processing. This completely untested patch
probably
fixes it.
START_PATCH
--- sv.c.orig 2006-08-15 13:37:41.000000000 +0100
+++ sv.c 2007-09-11 23:09:09.555166783 +0100
 -9138,7
+9138,7 
: SvNVx(argsv);
need = 0;
- if (c != 'e' && c != 'E') {
+ if (c != 'e' && c != 'E' && nv == nv)
{
i = PERL_INT_MIN;
/* FIXME: if HAS_LONG_DOUBLE but not USE_LONG_DOUBLE
this
will cast our (long double) to (double) */
END_PATCH
This problem came up in CPAN testers reports on one of my
modules.
I don't have a BSD system myself.
[Please do not change anything below this line]
(Actually I changed most of what's below this line, to
reflect
the perl on which this bug was seen.)
------------------------------------------------------------
-----
---
Flags:
category=core
severity=medium
---
Site configuration information for perl v5.9.5:
Summary of my perl5 (revision 5 version 9 subversion 5)
configuration:
Platform:
osname=netbsd, osvers=2.1.0_stable,
archname=alpha-netbsd
uname='netbsd sdf 2.1.0_stable netbsd 2.1.0_stable (sdf)
#0: fri mar 30 02:24:32 utc 2007 root ol:varsysarchalphacompilesdf alpha '
config_args='-Dusedevel
-Dprefix=/arpa/af/d/drhyde/perl-5.9.5 -de'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define,
usesocks=undef
use64bitint=define, use64bitall=define,
uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -pipe
-I/usr/pkg/include',
optimize='-O',
cppflags='-fno-strict-aliasing -pipe
-I/usr/pkg/include'
ccversion='', gccversion='3.3.3 (NetBSD nb3 20040520)',
gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8,
byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=8
ivtype='long', ivsize=8, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -Wl,-rpath,/usr/pkg/lib
-Wl,-rpath,/usr/local/lib -L/usr/pkg/lib'
libpth=/usr/pkg/lib /lib /usr/lib
libs=-lbind -lgdbm -lm -lcrypt -lutil -lc -lposix
perllibs=-lbind -lm -lcrypt -lutil -lc -lposix
libc=/lib/libc.so, so=so, useshrplib=false,
libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,
ccdlflags='-Wl,-E '
cccdlflags='-DPIC -fPIC ', lddlflags='--whole-archive
-shared -L/usr/pkg/lib'
|
|
| Re: sprintf %f panics with NaN |

|
2007-09-12 03:50:30 |
On Tue, 11 Sep 2007 15:22:23 -0700, Zefram (via RT)
<perlbug-followup perl.org> wrote:
> # New Ticket Created by Zefram
> # Please include the string: [perl #45383]
> # in the subject line of all future correspondence
about this issue.
> # <URL: h
ttp://rt.perl.org/rt3/Ticket/Display.html?id=45383 >
>
>
> This is a bug report for perl from zefram fysh.org,
> generated with the help of perlbug 1.35 running under
perl v5.8.8.
>
>
>
------------------------------------------------------------
-----
> [Please enter your report here]
>
> On NetBSD, frexp() produces silly results if given a
NaN argument.
> The effect on Perl is that sprintf with "%f"
format and a NaN argument
> gives the "panic: frexp" diagnostic. NaN is
a special case that doesn't
> need any frexp processing. This completely untested
patch probably
> fixes it.
>
> START_PATCH
> --- sv.c.orig 2006-08-15 13:37:41.000000000 +0100
> +++ sv.c 2007-09-11 23:09:09.555166783 +0100
>  -9138,7 +9138,7 
> : SvNVx(argsv);
>
> need = 0;
> - if (c != 'e' && c != 'E') {
> + if (c != 'e' && c != 'E' && nv ==
nv) {
From my C-knowledge point of view, I completely fail to see
the effect
of this change. If I were the C-optimizer, I'd throw away
that part.
It is like writing
if (1 == 1) {
ok ("this should always be true");
}
> i = PERL_INT_MIN;
> /* FIXME: if HAS_LONG_DOUBLE but not USE_LONG_DOUBLE
this
> will cast our (long double) to (double) */
> END_PATCH
>
> This problem came up in CPAN testers reports on one of
my modules.
> I don't have a BSD system myself.
>
> [Please do not change anything below this line]
> (Actually I changed most of what's below this line, to
reflect
> the perl on which this bug was seen.)
>
------------------------------------------------------------
-----
> ---
> Flags:
> category=core
> severity=medium
> ---
> Site configuration information for perl v5.9.5:
>
> Summary of my perl5 (revision 5 version 9 subversion 5)
configuration:
> Platform:
> osname=netbsd, osvers=2.1.0_stable,
archname=alpha-netbsd
> uname='netbsd sdf 2.1.0_stable netbsd 2.1.0_stable
(sdf) #0: fri mar 30 02:24:32 utc 2007 root ol:varsysarchalphacompilesdf alpha '
> config_args='-Dusedevel
-Dprefix=/arpa/af/d/drhyde/perl-5.9.5 -de'
> hint=recommended, useposix=true,
d_sigaction=define
> useithreads=undef, usemultiplicity=undef
> useperlio=define, d_sfio=undef,
uselargefiles=define, usesocks=undef
> use64bitint=define, use64bitall=define,
uselongdouble=undef
> usemymalloc=n, bincompat5005=undef
> Compiler:
> cc='cc', ccflags ='-fno-strict-aliasing -pipe
-I/usr/pkg/include',
> optimize='-O',
> cppflags='-fno-strict-aliasing -pipe
-I/usr/pkg/include'
> ccversion='', gccversion='3.3.3 (NetBSD nb3
20040520)', gccosandvers=''
> intsize=4, longsize=8, ptrsize=8, doublesize=8,
byteorder=12345678
> d_longlong=define, longlongsize=8,
d_longdbl=define, longdblsize=8
> ivtype='long', ivsize=8, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
> alignbytes=8, prototype=define
> Linker and Libraries:
> ld='cc', ldflags =' -Wl,-rpath,/usr/pkg/lib
-Wl,-rpath,/usr/local/lib -L/usr/pkg/lib'
> libpth=/usr/pkg/lib /lib /usr/lib
> libs=-lbind -lgdbm -lm -lcrypt -lutil -lc -lposix
> perllibs=-lbind -lm -lcrypt -lutil -lc -lposix
> libc=/lib/libc.so, so=so, useshrplib=false,
libperl=libperl.a
> gnulibc_version=''
> Dynamic Linking:
> dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,
ccdlflags='-Wl,-E '
> cccdlflags='-DPIC -fPIC ',
lddlflags='--whole-archive -shared -L/usr/pkg/lib'
>
>
--
H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/
)
using & porting perl 5.6.2, 5.8.x, 5.9.x on HP-UX
10.20, 11.00, 11.11,
& 11.23, SuSE 10.0 & 10.2, AIX 4.3 & 5.2, and
Cygwin. http://qa.perl.org
http://mirrors.de
velooper.com/hpux/ http://www.test-smoke.org
a>
http
://www.goldmark.org/jeff/stupid-disclaimers/
|
|
| Re: sprintf %f panics with NaN |

|
2007-09-12 05:09:22 |
On Tue, Sep 11, 2007 at 03:22:23PM -0700, Zefram wrote:
> On NetBSD, frexp() produces silly results if given a
NaN argument.
> The effect on Perl is that sprintf with "%f"
format and a NaN argument
> gives the "panic: frexp" diagnostic. NaN is
a special case that doesn't
> need any frexp processing. This completely untested
patch probably
> fixes it...
>
> This problem came up in CPAN testers reports on one of
my modules.
> I don't have a BSD system myself.
'Twas I who generated the original bug report. I'm
downloading blead as
we speak so I can test Zefram's patch.
--
David Cantrell | bond Perl Mongers Deputy Chief Heretic
The voices said it's a good day to clean my weapons
|
|
[1-3]
|
|