Skip Menu |
 

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

Report information
The Basics
Id: 84950
Status: new
Priority: 0/
Queue: Math-BigInt

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

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



Subject: BigFloat bpi() NaN when global precision() set
Date: Wed, 01 May 2013 06:00:24 +1000
To: bug-Math-BigInt [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
Download (untitled) / with headers
text/plain 703b
In Math::BigFloat 1.997 and recent debian i386 perl 5.14.3, if a global Math::BigFloat->precision() has been set then bpi() returns NaN. Eg. the program foo.pl below prints "NaN". foo.pl asks for precision -100 to have 100 decimal places and I hoped bpi(5) asking for pi to 5 places still would work in that case. Nosing around the code I see bpi() calls bdiv() with a specified accuracy, and it seems the usual _find_round_parameters() rejects a simultaneous accuracy and precision in force. I suppose if the precision() is less than the bpi number of digits then take the lesser of the two, the same as results when an accuracy() is in force and you ask bpi for more digits than that accuracy.
Download foo.pl
text/x-perl 113b
use strict; use Math::BigFloat; Math::BigFloat->precision(-100); my $pi = Math::BigFloat->bpi(5); print "$pi\n";


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.