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
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.
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
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.