Skip Menu |

This queue is for tickets about the Math-BigInt CPAN distribution.

Report information
The Basics
Id: 15896
Status: resolved
Worked: 15 min
Priority: 0/
Queue: Math-BigInt

People
Owner: TELS [...] cpan.org
Requestors: bricas [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.77
Fixed in: (no value)



Subject: "==" overloading is broken for "NaN"
Hi, This stems from a bug report filed in Authen::TypeKey (http://rt.cpan.org/NoAuth/Bug.html?id=15895). The attached test shows that when comparing a "NaN" to a regular Math::BigInt, it returns true; though stringification shows otherwise. Here's the output on my machine: 1..4 ok 1 - The object isa Math::BigInt ok 2 - The object isa Math::BigInt $VAR1 = bless( { 'value' => [ 0 ], 'sign' => 'NaN' }, 'Math::BigInt' ); $VAR2 = bless( { 'value' => [ 12345 ], 'sign' => '+' }, 'Math::BigInt' ); ok 3 - $value1 should not equal $value2 (stringified) not ok 4 - $value1 should not equal $value2 (== overload) # Failed test (bigint.t at line 13) # Looks like you failed 1 test of 4. I've added some warnings to show what the variables look like underneath. -Brian
use Test::More tests => 4; use Math::BigInt; use Data::Dumper; my $value1 = Math::BigInt->new( 'foo' ); isa_ok( $value1, 'Math::BigInt' ); my $value2 = Math::BigInt->new( 12345 ); isa_ok( $value2, 'Math::BigInt' ); warn Dumper $value1, $value2; ok( !( "$value1" == "$value2" ), '$value1 should not equal $value2 (stringified)' ); ok( !( $value1 == $value2 ), '$value1 should not equal $value2 (== overload)' );
I just released Math::BigInt 1.80 to CPAN, which fixes this issue in both BigInt and BigFloat. Thank you for your report, and sorry for the long delay.