Skip Menu |

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

Report information
The Basics
Id: 101443
Status: resolved
Priority: 0/
Queue: Math-GMP

People
Owner: Nobody in particular
Requestors: HVDS [...] cpan.org
Cc:
AdminCc:

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



Subject: Math::GMP needs bool overload
Math::GMP->new($obj) can fail if $obj is already a Math::GMP object for a large number. This is because in new we have C< my $ival = shift || 0; >, and the boolean check falls back to the intify overload in the absence of an explicit bool overload (and the intify is truncating). Attached change is enough to fix that (forcing it to use the <=> overload instead); intify() itself could also do with improvement, but I haven't attempted that at this point. Hugo
Subject: Math-GMP-bool-overload
Download Math-GMP-bool-overload
application/octet-stream 2k

Message body not shown because it is not plain text.

It sounds like perhaps 92564 (incorrect intify) is the root cause?
On Sat Jan 10 10:36:54 2015, HVDS wrote: Show quoted text
> Math::GMP->new($obj) can fail if $obj is already a Math::GMP object > for a large number. This is because in new we have C< my $ival = shift > || 0; >, and the boolean check falls back to the intify overload in > the absence of an explicit bool overload (and the intify is > truncating). > > Attached change is enough to fix that (forcing it to use the <=> > overload instead); intify() itself could also do with improvement, but > I haven't attempted that at this point. > > Hugo
Thanks for the patch. I applied a modified version of it in commit 28f3f97f3686ca6f3e037cd1e466ddace8c0c05c in the repository. See: https://github.com/turnstep/Math-GMP/commit/28f3f97f3686ca6f3e037cd1e466ddace8c0c05c RESOLVEDing. Regards, -- Shlomi Fish