Re: [ID 20000306.004] unpack(NaN) big baddaboom

2000-03-06 Thread Peter Jeremy
On 2000-Mar-07 05:35:04 +1100, Ian Grigg <[EMAIL PROTECTED]> wrote: >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"; Looking at the resul

Re: [ID 20000306.004] unpack(NaN) big baddaboom

2000-03-06 Thread Poul-Henning Kamp
In message <[EMAIL PROTECTED]>, Ian Grigg writes: >> 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 tra

Re: [ID 20000306.004] unpack(NaN) big baddaboom

2000-03-06 Thread Ian Grigg
More on that! Lads here took this to heart and put the debugger over the code. Apparently, Linux uses glibc which sets the flags in FPU to ignore the cmp-NaN fault. Then, I guess, Perl picks it up and turns it into NaN. OTOH, FreeBSD libraries don't do that, and the FPU causes the cmp-NaN faul

Re: [ID 20000306.004] unpack(NaN) big baddaboom

2000-03-06 Thread Poul-Henning Kamp
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