Skip Menu |

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

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

People
Owner: TELS [...] cpan.org
Requestors: nospam-abuse [...] bloodgate.com
Cc:
AdminCc:

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



Subject: non-integer A and P make bsqrt/broot/bdiv etc. unhappy
Consider: # perl -Mbignum -wle 'print 2->bsqrt(11)' 1.4142135624 # perl -Mbignum -wle 'print 2->bsqrt(11.1)' 1.41421356237 # perl -Mbignum -wle 'print 2->bsqrt(11.6)' 4.4721359550 # perl -Mbignum=l,GMP -wle 'print 2->bsqrt(11)' 1.4142135624 # perl -Mbignum=l,GMP -wle 'print 2->bsqrt(11.1)' 1.0000000000 # perl -Mbignum=l,GMP -wle 'print 2->bsqrt(11.6)' 1.0000000000 In short, passing non-integer arguments as A (number of significant digits in result) makes bsqrt() (and thus also broot()) and probably others quite unhappy. This is easily triggered by naïve code like: my $n = 100; my $y = Math::BihgFloat->new(2)->bsqrt($n + $n / 1000 + 4); bdiv() seems only affected in GMP: # perl -Mbignum -wle 'print scalar 1->bdiv(3,11)' 0.33333333333 # perl -Mbignum -wle 'print scalar 1->bdiv(3,11.1)' 0.333333333333 # perl -Mbignum -wle 'print scalar 1->bdiv(3,11.6)' 0.333333333333 # perl -Mbignum=l,GMP -wle 'print scalar 1->bdiv(3,11)' 0.33333333333 # perl -Mbignum=l,GMP -wle 'print scalar 1->bdiv(3,11.1)' 0 # perl -Mbignum=l,GMP -wle 'print scalar 1->bdiv(3,11.6)' 0 But P is affected as well as A: # perl -Mbignum=l,GMP -wle 'print scalar 1->bdiv(3,undef,-11)' 0.33333333333 # perl -Mbignum=l,GMP -wle 'print scalar 1->bdiv(3,undef,-11.1)' 0.00000000000 # perl -Mbignum=l,GMP -wle 'print scalar 1->bdiv(3,undef,-11.6)' 0.00000000000 It is unclear if there is a global fix, or if this must be fixed for each math operation on its own. Tels
Fixed in the upcoming release of v1.88.
Resolved with the release of v1.88.