In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/fbc70a9e6c5a8b48dcdf2aa4f1f639d7064649cf?hp=2fcf74c430eb128c4c1c7b5aa80c20c69ff19f53>
- Log ----------------------------------------------------------------- commit fbc70a9e6c5a8b48dcdf2aa4f1f639d7064649cf Author: Paul Johnson <[email protected]> Date: Sun Mar 6 00:55:21 2011 +0100 Minor spelling fix. M Porting/epigraphs.pod commit 913a64d572c047fbf9e646912677430ae169371b Author: Peter John Acklam <[email protected]> Date: Sat Mar 5 16:55:30 2011 -0800 [perl #85482] Make bmuladd() able to handle third arg properly. bmuladd() contains a test to avoid calling objectify() when it isn't necessary. This test catches too much, so objectify() isn't always called when it should have been, e.g., when the two first arguments are are Math::BigInts and the third is something else, a Math::BigInt::Lite for example. This causes tests in Math::BigInt::Lite to fail (RT #66369). Also fix bmuladd() in Math::BigFloat since it suffers from the same problem. M dist/Math-BigInt/lib/Math/BigFloat.pm M dist/Math-BigInt/lib/Math/BigInt.pm commit 02916adf982e17a20465ed6e7008686ec9499a1e Author: Peter John Acklam <[email protected]> Date: Sat Mar 5 14:38:36 2011 -0800 [perl #85476] Add tests to confirm fix of RT #49569. Confirm that numify() on a value that can be represented exactly as a Perl scalar integer is not converted to a floating point number, e.g., that it returns 18446744073709551615, not 1.84467440737096e+19. M dist/Math-BigInt/t/bare_mbi.t M dist/Math-BigInt/t/bigintpm.inc M dist/Math-BigInt/t/bigintpm.t M dist/Math-BigInt/t/sub_mbi.t commit 6bd767fbea22eb93805d6b5257c8283931aac3db Author: Peter John Acklam <[email protected]> Date: Sat Mar 5 14:15:30 2011 -0800 [perl #85334] Document actual behaviour of from_xxx() methods. Add more precise documentation of the behaviour of from_oct(), from_hex(), and from_bin(). M dist/Math-BigInt/lib/Math/BigInt.pm ----------------------------------------------------------------------- Summary of changes: Porting/epigraphs.pod | 2 +- dist/Math-BigInt/lib/Math/BigFloat.pm | 7 +------ dist/Math-BigInt/lib/Math/BigInt.pm | 20 ++++++++++++++------ dist/Math-BigInt/t/bare_mbi.t | 2 +- dist/Math-BigInt/t/bigintpm.inc | 21 +++++++++++++++++++++ dist/Math-BigInt/t/bigintpm.t | 2 +- dist/Math-BigInt/t/sub_mbi.t | 2 +- 7 files changed, 40 insertions(+), 16 deletions(-) diff --git a/Porting/epigraphs.pod b/Porting/epigraphs.pod index ed3bf04..0a491a7 100644 --- a/Porting/epigraphs.pod +++ b/Porting/epigraphs.pod @@ -19,7 +19,7 @@ Consult your favorite dictionary for details. =head2 v5.13.10 - Egill Skalla-GrÃmsson, L<Egils saga Skalla-GrÃmssonar|http://www.heimskringla.no/wiki/Egils_saga_Skalla-Gr%C3%ADmssonar> -L<Annonced on 2011-02-20 by Ãvar Arnfjörð Bjarmason|http://www.nntp.perl.org/group/perl.perl5.porters/2011/02/msg169340.html> +L<Announced on 2011-02-20 by Ãvar Arnfjörð Bjarmason|http://www.nntp.perl.org/group/perl.perl5.porters/2011/02/msg169340.html> Skalat maðr rúnar rÃsta, nema ráða vel kunni. diff --git a/dist/Math-BigInt/lib/Math/BigFloat.pm b/dist/Math-BigInt/lib/Math/BigFloat.pm index 07d33cc..06a6e48 100644 --- a/dist/Math-BigInt/lib/Math/BigFloat.pm +++ b/dist/Math-BigInt/lib/Math/BigFloat.pm @@ -1697,12 +1697,7 @@ sub bmuladd # multiply two numbers and add the third to the result # set up parameters - my ($self,$x,$y,$z,@r) = (ref($_[0]),@_); - # objectify is costly, so avoid it - if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) - { - ($self,$x,$y,$z,@r) = objectify(3,@_); - } + my ($self,$x,$y,$z,@r) = objectify(3,@_); return $x if $x->modify('bmuladd'); diff --git a/dist/Math-BigInt/lib/Math/BigInt.pm b/dist/Math-BigInt/lib/Math/BigInt.pm index 3e22d0f..bb1f518 100644 --- a/dist/Math-BigInt/lib/Math/BigInt.pm +++ b/dist/Math-BigInt/lib/Math/BigInt.pm @@ -1573,12 +1573,7 @@ sub bmuladd # (BINT or num_str, BINT or num_str, BINT or num_str) return BINT # set up parameters - my ($self,$x,$y,$z,@r) = (ref($_[0]),@_); - # objectify is costly, so avoid it - if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1]))) - { - ($self,$x,$y,$z,@r) = objectify(3,@_); - } + my ($self,$x,$y,$z,@r) = objectify(3,@_); return $x if $x->modify('bmuladd'); @@ -3656,14 +3651,27 @@ See L<Input> for more info on accepted input formats. $x = Math::BigInt->from_oct("0775"); # input is octal +Interpret the input as an octal string and return the corresponding value. A +"0" (zero) prefix is optional. A single underscore character may be placed +right after the prefix, if present, or between any two digits. If the input is +invalid, a NaN is returned. + =head2 from_hex() $x = Math::BigInt->from_hex("0xcafe"); # input is hexadecimal +Interpret input as a hexadecimal string. A "0x" or "x" prefix is optional. A +single underscore character may be placed right after the prefix, if present, +or between any two digits. If the input is invalid, a NaN is returned. + =head2 from_bin() $x = Math::BigInt->from_bin("0b10011"); # input is binary +Interpret the input as a binary string. A "0b" or "b" prefix is optional. A +single underscore character may be placed right after the prefix, if present, +or between any two digits. If the input is invalid, a NaN is returned. + =head2 bnan() $x = Math::BigInt->bnan(); diff --git a/dist/Math-BigInt/t/bare_mbi.t b/dist/Math-BigInt/t/bare_mbi.t index a73fd12..d7139dd 100644 --- a/dist/Math-BigInt/t/bare_mbi.t +++ b/dist/Math-BigInt/t/bare_mbi.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w use strict; -use Test::More tests => 3619; +use Test::More tests => 3623; BEGIN { unshift @INC, 't'; } diff --git a/dist/Math-BigInt/t/bigintpm.inc b/dist/Math-BigInt/t/bigintpm.inc index f5f0fd2..e52a271 100644 --- a/dist/Math-BigInt/t/bigintpm.inc +++ b/dist/Math-BigInt/t/bigintpm.inc @@ -524,6 +524,27 @@ is (ref($x),'Math::Foo'); $x = $class->new('+inf'); is ($x,'inf'); ############################################################################### +# numify() and 64 bit integer support + +require Config; +SKIP: { + skip("no 64 bit integer support", 4) + unless $Config::Config{use64bitint} || $Config::Config{use64bitall}; + + # The following should not give "1.84467440737096e+19". + + $x = $class -> new(2) -> bpow(64) -> bdec(); + is($x -> bstr(), "18446744073709551615", "bigint 2**64-1 as string"); + is($x -> numify(), "18446744073709551615", "bigint 2**64-1 as number"); + + # The following should not give "-9.22337203685478e+18". + + $x = $class -> new(2) -> bpow(63) -> bneg(); + is($x -> bstr(), "-9223372036854775808", "bigint -2**63 as string"); + is($x -> numify(), "-9223372036854775808", "bigint -2**63 as number"); +}; + +############################################################################### ############################################################################### # the following tests only make sense with Math::BigInt::Calc or BareCalc or # FastCalc diff --git a/dist/Math-BigInt/t/bigintpm.t b/dist/Math-BigInt/t/bigintpm.t index d16844b..cacdb8e 100644 --- a/dist/Math-BigInt/t/bigintpm.t +++ b/dist/Math-BigInt/t/bigintpm.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w use strict; -use Test::More tests => 3619 + 6; +use Test::More tests => 3623 + 6; use Math::BigInt lib => 'Calc'; diff --git a/dist/Math-BigInt/t/sub_mbi.t b/dist/Math-BigInt/t/sub_mbi.t index a999c09..668fd19 100644 --- a/dist/Math-BigInt/t/sub_mbi.t +++ b/dist/Math-BigInt/t/sub_mbi.t @@ -1,7 +1,7 @@ #!/usr/bin/perl -w use strict; -use Test::More tests => 3619 +use Test::More tests => 3623 + 5; # +5 own tests BEGIN { unshift @INC, 't'; } -- Perl5 Master Repository
