-----BEGIN PGP SIGNED MESSAGE-----
Moin,
On Tuesday 26 July 2005 01:15, Guest via RT wrote:
Show quoted text> This message about bignum was sent to you by guest <> via rt.cpan.org
>
> Full context and any attached attachments can be found at:
> <URL:
https://rt.cpan.org/Ticket/Display.html?id=13866 >
>
> Hi Tels,
>
> use warnings;
> use bigint;
>
> my $z = NaN;
> my $x = NaN;
>
> if($x == $z) {print "Not ok\n"}
> else {print "Ok\n"}
>
> __END__
>
> On Win32, perl 5.8.7, I believe that script should produce simply:
>
> Ok
inf != inf (due to inf +1 == inf and thus inf != inf).
NaN might be == NaN - I forgot the reasoning, trough.
However, from Math::BigInt:
==, !=, <, >, <=, >= with NaNs
BigInt’s bcmp() routine currently returns undef to sig
(that is why you get the warning)
nal that a NaN was involved in a comparisation. However,
the overload code turns that into either 1 or ’’ and
thus operations like "NaN != NaN" might return wrong
values.
So:
#perl -MMath::BigInt -le 'print 1 if Math::BigInt->bnan() ==
Math::BigInt->bnan()'
1
# perl -Mbignum -le 'print NaN == NaN'
1
# perl -Mbignum -le 'print NaN != NaN'
# perl -Mbignum -le 'print NaN != 1'
# perl -Mbignum -le 'print NaN == 1'
1
Oh well.
Show quoted text> Instead, I'm getting:
>
> Use of uninitialized value in numeric eq (==) at try.pl line 7.
> Not ok
> If I change both occurrences of NaN to inf, then I still get "Not ok" -
> though there's no warning about any uninitialised value.
As I said, inf != inf. Dont ask me - I consider the entire NaN and inf
stuff so wierd that I always get headaches from it. But there really
might be bugs in my code.
Best wishes,
Tels
- --
Signed on Tue Jul 26 18:04:26 2005 with key 0x93B84C15.
Visit my photo gallery at
http://bloodgate.com/photos/
PGP key on
http://bloodgate.com/tels.asc or per email.
"Und jetzt kommen Sie!" - Stenkelfeld
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iQEVAwUBQuZg9ncLPEOTuEwVAQHE5Qf9EYjl1Hz7Y+hOHCKf0bCW/gRniNH6K+1u
tKibxvYThsTwOULs/Nxdfy13Max9pfO9xmvII79qwSvbmMtSHgnja1301T98Gkpr
lTGuxUd3JB/LDPAJGl0C7wllxd9wJAdELUc5ab5keHqcm7tYkajKwhKU9udo2W1E
CQw6lZq1Fa7KdqmvfMQl3TI1FP8DGqTGCWZIyAUs6klqZ8qTASltdYByjY/jkiJA
F8+xF2BbhcBpZM/Pd3lr+S3tYx16XwmArzDYPiA0YwhOUvfEp8Hj9FeWiE47YKEO
8USh/GtD51qSyAPG2w0XNmL8dQXve+/xoQa4l8hOf0VA1dip0QSjFQ==
=nXWQ
-----END PGP SIGNATURE-----