develooper Front page | perl.perl5.porters | Postings from July 2005

[perl #2269] unpack(NaN) big baddaboom

Thread Previous | Thread Next
From:
Michael G Schwern via RT
Date:
July 12, 2005 20:09
Subject:
[perl #2269] unpack(NaN) big baddaboom
Message ID:
rt-3.0.11-2269-117134.1.9787699138579@perl.org
> [iang@systemics.com - Mon Mar 06 02:33:55 2000]:
> 
> 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<====

Anyone have a FreeBSD machine handy with a recent Perl on it to try this
out?


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About