Skip Menu |
 

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

Report information
The Basics
Id: 66633
Status: resolved
Priority: 0/
Queue: Math-BigInt

People
Owner: Nobody in particular
Requestors: peter.john.acklam [...] gmail.com
Cc:
AdminCc:

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



Subject: bdiv() returns incorrect remainder when BigInts are autoupgraded to BigFloats
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 354
Download (untitled) / with headers
text/plain 354b
The docs say that ($q,$r) = $x->bdiv($y) returns $q and $r so that $x = $q*$y + $r, but this does not hold in the following case: $ perl -MMath::BigInt=upgrade,Math::BigFloat -MMath::BigFloat -wle '$x = Math::BigInt->new(22); $y = Math::BigFloat->new(7); print for $x->bdiv($y)' 3.142857142857142857142857142857142857143 1 The remainder should be zero.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-18152-1341858268-178.66633-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 242
Download (untitled) / with headers
text/plain 242b
This is still an issue with the latest version: Show quoted text
>perl -MMath::BigInt=upgrade,Math::BigFloat -MMath::BigFloat -wle "$x =
Math::BigInt->new(22); $y = Math:: BigFloat->new(7); print for $x->bdiv($y)" 3.142857142857142857142857142857142857143 1
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-20613-1442316130-1598.66633-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 213
Download (untitled) / with headers
text/plain 213b
Math::BigFloat -> bdiv() now does what the documentation said it should do: In scalar context, it does true division. In list context, it returns an integer divisor and the remainder. Fixed in Math-BigInt-1.9994.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.