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 resultant core file, perl is getting SIGFPE inside
cast_i32() (probably when it tries to cast the NaN to an int).
Unfortunately, the code for cast_i32() does not handle NaNs (though it
does handle infinity).  (And it's not clear what integer value should
be associated with NaN in any case).

As to whether it should trap or not, that is less clear-cut.  FreeBSD
takes the view that trying to convert a NaN into an integer is not a
sensible operation, so it signals SIGFPE (the i386 NPX gives an
invalid operand exception).  Other implementations may differ.

Peter


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to