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
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 1484
Download (untitled) / with headers
text/plain 1.4k
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
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Charset: utf8
Message-Id: <rt-3.6.HEAD-8345-1206741362-1072.29388-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 39
Fixed in the upcoming release of v1.88.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Charset: utf8
Message-Id: <rt-3.6.HEAD-24883-1207408518-870.29388-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 35
Resolved with the release of v1.88.


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.