Skip Menu |
 

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

Report information
The Basics
Id: 84953
Status: resolved
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: 1.999714



Subject: batan2(1,0) not following global accuracy()
Date: Wed, 01 May 2013 06:50:23 +1000
To: bug-Math-BigInt [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
Download (untitled) / with headers
text/plain 769b
In Math::BigFloat 1.997 and recent debian i386 perl 5.14.3, if a global Math::BigFloat->accuracy(100) has been set then batan2() of Y=1,X=0 only gives 40 decimal places of accuracy, not the requested 100. Eg. the program atan2.pl below prints 1.570796326794896619231321691639751442098000000000000000000000000000000000000000000000000000000000000 whereas I expected the trailing 0s to be some non-zero value. If $x is some small non-zero value, such as 1e-10 then the desired full 100 decimals are returned. In the code I wonder if the special cases for X=0 and Y=0 giving pi/2 etc could look also at the accuracy() and/or precision setting on $y or $x or global or whatever, so as to ensure the result in those cases is the same accuracy as the general case.
Download atan2.pl
text/x-perl 157b
use strict; use Math::BigFloat; Math::BigFloat->accuracy(100); my $y = Math::BigFloat->new(1); my $x = Math::BigFloat->new(0); $y->batan2($x); print "$y\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.