Subject: | Cross-platform interoperability with BASE_LEN |
Date: | Tue, 28 Oct 2014 15:50:25 -0400 |
To: | <bug-Math-BigFloat [...] rt.cpan.org> |
From: | "Todd Davenport" <tdavenport [...] 4-catalyst.com> |
See here: https://rt.cpan.org/Public/Bug/Display.html?id=99484
This bug should probably be here in BigFloat instead of in BigInt.
The BASE_LEN values are not cross-platform interoperable.
So for example, on a 64-bit Strawberry Perl on Windows (This is perl 5,
version 18, subversion 2 (v5.18.2) built for MSWin32-x64-multi-thread):
use Math::BigFloat;
my $MBI = 'Math::BigInt::Calc';
my $num = bless( {"_m" => [4995822,1],"_es" => "-","_p" => -3,"_e" =>
[3],"sign" => "+"}, 'Math::BigFloat' );
print "baselen is ".$MBI->_base_len."\n";
print "num is ".$num->bstr."\n";
gives the following output:
baselen is 9
num is 1004995.822
On a 32-bit ActivePerl on Windows (This is perl, v5.8.8 built for
MSWin32-x86-multi-thread) :
The output for the same code is:
baselen is 7
num is 14995.822
By making the BASE_LEN a private member of BigFloat, we can pass it to the
MBI helper. Here's an idea of how to implement it:
https://github.com/microtodd/Perl-Math-BigFloat