Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 06 Mar 2000 19:43:56 +0100
From:      Poul-Henning Kamp <phk@critter.freebsd.dk>
To:        iang@systemics.com
Cc:        perl5-porters@perl.org, current@FreeBSD.ORG
Subject:   Re: [ID 20000306.004] unpack(NaN) big baddaboom 
Message-ID:  <9711.952368236@critter.freebsd.dk>
In-Reply-To: Your message of "Mon, 06 Mar 2000 14:31:57 -0400." <200003061831.OAA74965@systemics.com> 

next in thread | previous in thread | raw e-mail | index | archive | help

That is because FreeBSD correctly traps operations on the value NaN.

Depending on your religion the bug is either in perl itself which
should be more careful about NaN and Inf values, or in the perl
script you supply which does something which is patently bogus,
but nothing which should provoke a FP trap according to IEEE.

I would argue that as long as your perl script doesn't use the NaN
in an operation which IEEE documents as giving a trap ( compare of
two floats for ordered magnitude for instance) then your perl
interpreter shouldn't either.

Poul-Henning

In message <200003061831.OAA74965@systemics.com>, Ian Grigg writes:
>
>This is a bug report for perl from iang@systemics.com,
>generated with the help of perlbug 1.26 running under perl 5.00503.
>
>
>-----------------------------------------------------------------
>[Please enter your report here]
>
>Running following program causes "Floating point exception" on
>FreeBSD 3.2-STABLE *and* 4.0-CURRENT #0: Tue Feb 29 02:11:52 AST 2000
>(but not on Linux "2.3.44 #12 SMP") (all 5.00503)
>
>===8<======8<======8<======8<====
>#!/usr/bin/perl
>
>my $packed = "\0\0\xc0\x7f";
>print STDERR "len: ", length($packed), " bytes: ", unpack("H*", $packed), "\n";
>my $float = unpack("f", $packed);
>print STDERR "float done\n";
>print STDERR "float: $float\n";
>
>exit 0;
>===8<======8<======8<======8<====
>hayek$ ./moo.pl
>len: 4 bytes: 0000c07f
>float done
>Floating point exception
>hayek$ echo $?
>136
>hayek$ 
>===8<======8<======8<======8<====
>
>
>[Please do not change anything below this line]
>-----------------------------------------------------------------
>
>---
>This perlbug was built using Perl 5.00502 - Mon Oct 26 16:01:51 AST 1998
>It is being executed now by  Perl 5.00503 - $Date: 1999/05/05 19:42:40 $.
>
>Site configuration information for perl 5.00503:
>
>Configured by markm at $Date: 1999/05/05 19:42:40 $.
>
>Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
>  Platform:
>    osname=freebsd, osvers=4.0-current, archname=i386-freebsd
>    uname='freebsd freefall.freebsd.org 4.0-current freebsd 4.0-current #0: $Date: 1999/05/05 19:42:40 $'
>    hint=recommended, useposix=true, d_sigaction=define
>    usethreads=undef useperlio=undef d_sfio=undef
>  Compiler:
>    cc='cc', optimize='undef', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release)
>    cppflags=''
>    ccflags =''
>    stdchar='char', d_stdstdio=undef, usevfork=true
>    intsize=4, longsize=4, ptrsize=4, doublesize=8
>    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
>    alignbytes=4, usemymalloc=n, prototype=define
>  Linker and Libraries:
>    ld='cc', ldflags ='-Wl,-E'
>    libpth=/usr/lib
>    libs=-lm -lc -lcrypt
>    libc=/usr/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so.3
>  Dynamic Linking:
>    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
>    cccdlflags='-DPIC -fpic', lddlflags='-shared'
>
>Locally applied patches:
>    
>
>---
>@INC for perl 5.00503:
>    /data/ricardo/perl
>    /home/iang/src/hayek/ricardo/blib/lib
>    /usr/libdata/perl/5.00503/mach
>    /usr/libdata/perl/5.00503
>    /usr/local/lib/perl5/site_perl/5.005/i386-freebsd
>    /usr/local/lib/perl5/site_perl/5.005
>    .
>
>---
>Environment for perl 5.00503:
>    HOME=/home/iang
>    LANG (unset)
>    LD_LIBRARY_PATH (unset)
>    LOGDIR (unset)
>    PATH=/home/iang/src/hayek/market/cmd:/home/iang/src/hayek/market/bin:/data/ricardo/perl/cmd:/home/iang/src/hayek/ricardo/cmd:/home/iang/bin:/home/iang/cmd:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/java/bin:/sbin:/usr/sbin:/usr/local/sbin
>    PERLLIB=/data/ricardo/perl:/home/iang/src/hayek/ricardo/blib/lib
>    PERL_BADLANG (unset)
>    SHELL=/usr/local/bin/bash
>
>
>To Unsubscribe: send mail to majordomo@FreeBSD.org
>with "unsubscribe freebsd-current" in the body of the message
>

--
Poul-Henning Kamp             FreeBSD coreteam member
phk@FreeBSD.ORG               "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9711.952368236>