Commit 4e3ccc1d authored by Salvatore Bonaccorso's avatar Salvatore Bonaccorso

Imported Upstream version 1.999708

parent 19407e3b
......@@ -1431,7 +1431,7 @@ The changes are now grouped by distribution.
* Add documentation for as_float() in lib/Math/BigFloat.pm
* Added test files t/objectify_mbf.t and t/objectify_mbi.t.
* Add test files t/objectify_mbf.t and t/objectify_mbi.t.
2015-10-26 v1.999705 pjacklam
......@@ -1442,20 +1442,20 @@ The changes are now grouped by distribution.
2015-10-28 v1.999706 pjacklam
* Corrected release date of v1.999705 in CHANGES.
* Correct release date of v1.999705 in CHANGES.
* Added code and tests for numify() on non-finite objects.
* Add code and tests for numify() on non-finite objects.
2015-10-29 v1.999707 pjacklam
* Added dependency on Math::Complex 1.39 for Math::Complex::Inf(), which is
* Add dependency on Math::Complex 1.39 for Math::Complex::Inf(), which is
used for numifying infinity.
* Updated author information.
* Update author information.
* Updated information in the file README.
* Update information in the file README.
* Removed the files INSTALL and LICENSE as this information is already covered
* Remove the files INSTALL and LICENSE as this information is already covered
in the file README.
* Enable 'use warnings' in all modules. We require a Perl newer than 5.6.0
......@@ -1468,6 +1468,26 @@ The changes are now grouped by distribution.
* Moved 'Test::More' from 'build_requires' to 'test_requires' in Makefile.PL.
2015-11-03 v1.999708 pjacklam
* Use bxxx() method names consistently, rather than mixing bxxx() and fxxx()
in code and test files. The fxxx() methods for Math::BigFloat objects are
still available through autoloading. However, we leave the fround() method
in Math::BigInt, as it seems to provide some kind of compatibility with
Math::BigFloat.
* Correct author information in the README file.
* Remove INSTALL file, which by accident wasn't removed in v1.999707.
* Use present tense, not past tense, in CHANGES file.
* Add '#!perl' to Makefile.PL for correct syntax highlighting in editors
supporting this.
* Use Math::Complex::Inf() in testfiles also (for generating Perl scalar
infinity) since it is more portable.
Please send us test-reports, your experiences with this and your ideas - we love
to hear about our work!
......
......@@ -40,6 +40,6 @@
}
},
"release_status" : "stable",
"version" : "1.999707",
"version" : "1.999708",
"x_serialization_backend" : "JSON::PP version 2.27300"
}
......@@ -22,5 +22,5 @@ requires:
Math::Complex: '1.39'
Test::More: '0.62'
perl: '5.006002'
version: '1.999707'
version: '1.999708'
x_serialization_backend: 'CPAN::Meta::YAML version 0.016'
#!perl
# We need at least Perl 5.6
require 5.006002;
use strict;
......
......@@ -37,7 +37,13 @@ You can also look for information at:
COPYRIGHT AND LICENCE
Copyright 2007-2010 Peter John Acklam <pjacklam@online.no>
Copyright 1996-2001 Mark Biggar, Ilya Zakharevich.
Copyright 2001-2008 Tels, L<http://bloodgate.com>.
Copyright 2010 Florian Ragwitz L<flora@cpan.org>.
Copyright 2011- Peter John Acklam L<pjacklam@online.no>.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
......@@ -16,18 +16,18 @@ Hash: SHA1
SHA1 f6ef98e8f3f6a4f670d569f279ef5a3c05c16d0c BENCHMARK
SHA1 d681b992c9e027633a59fbd52530805ee4e1621c BUGS
SHA1 e1631812ed199c52be5185306d15e4bb4593891c CHANGES
SHA1 c380b0fefc9e2de150524fa21316cd437fe2a72c CHANGES
SHA1 f27c8bd98e754f96c9825fa6ce9f1244c93bdbe6 CREDITS
SHA1 bc2db74538d3acd53f71b5512a144fe18c253ecd GOALS
SHA1 fe61299e80a1dca48fbaa33f0869e3238ec07c70 HISTORY
SHA1 d6a6c30ee6d9ba6b9afab8bbf6a25e1b23c744e0 LICENSE
SHA1 e717092a11b1e42a0a7b340c68e75fa84b8a68b8 MANIFEST
SHA1 86df44fbe1ea7a68897113f0e327d0f0c25b91e3 MANIFEST.SKIP
SHA1 20885b2d7e7695e64a9164d2b557a3f728de8a84 META.json
SHA1 0b7fa178b5c3b96317f466af4de50517da24442d META.yml
SHA1 a3da36a5af3eedcf0461fea65319bc69e8ff69ee Makefile.PL
SHA1 3be1ef46b80d8582927d3409862840bcc8ff35ce META.json
SHA1 7811a0e4c31565c82f8f264759c21dd6a4ef78e6 META.yml
SHA1 e73fa91f03bf0cb3b117845cd60c200fb30be2ca Makefile.PL
SHA1 4e2191d1724e699862efc5350f480c8e02755112 NEW
SHA1 a1c4ab669fbeff68e7965c1bc3ced16d17a9f2f5 README
SHA1 813c62e6d3edd18b7b634765ecbd75b2cd6389a0 README
SHA1 f1500916b488220b707bc10a0388d7dbcfd52e99 TODO
SHA1 c2bbe82659480de8710b9e64a62d47b64dddd2d2 examples/1000.txt
SHA1 fe55e27b4791656d36a6c9548280746de7003be5 examples/bigprimes.pl
......@@ -40,10 +40,10 @@ SHA1 76efdca3603159e0ae0e18f19fe72a0211a69529 inc/Module/Install/Makefile.pm
SHA1 2e33e87882d60db3913da6284dd5295e5315e18a inc/Module/Install/Metadata.pm
SHA1 c830b819e61bda5eca077c6291293bba61b3b9f2 inc/Module/Install/Win32.pm
SHA1 cb52b9d6f88d512d448a6f35ed0af0d1201a134b inc/Module/Install/WriteAll.pm
SHA1 1914eb138f472f8fc090078c7b44259b000e3069 lib/Math/BigFloat.pm
SHA1 5c79f8bb3acd0d867409ee39b2a9c32ae70e1ca6 lib/Math/BigInt.pm
SHA1 486fc42db97cd2a05ea4c845e0bae2733d3d2896 lib/Math/BigInt/Calc.pm
SHA1 56ceeb7353bf171e53dc2f8bb662a20c9f530f8b lib/Math/BigInt/CalcEmu.pm
SHA1 cb779827a1fc79975094e40f169fa25ea1321835 lib/Math/BigFloat.pm
SHA1 ceee066901c52d7e1f6d55cf16b249e1caea6f71 lib/Math/BigInt.pm
SHA1 d8f02a9bb0434f8116f97fc8e3c7bcdfb23f7091 lib/Math/BigInt/Calc.pm
SHA1 2aee9080c2c3098afaa3dda4000fb3dfa858059e lib/Math/BigInt/CalcEmu.pm
SHA1 385cc7ed3bf3e6290640b9880445ca9a3dea629e t/00sig.t
SHA1 4463fdcebb8421cc2e63f87d678adb47856bf58c t/01load.t
SHA1 b2ed9206ca5b69ec3b8bbf850bf4b6dfde518e7e t/02pod.t
......@@ -58,10 +58,10 @@ SHA1 9f0d228c71dd1b49ea6de9ea9f67dcf30d3edccc t/bare_mbf.t
SHA1 633a5d1446321301fe2fbf8d440111ad62ffddfb t/bare_mbi.t
SHA1 97fb1db80aeb4ab007e2260d35329e149edf5e05 t/bare_mif.t
SHA1 333a425247b4e276696210a6322b815a0f55f5ab t/big_pi_e.t
SHA1 9bc755bda3026da5300d62e88bd797ead7366348 t/bigfltpm.inc
SHA1 10f64067004036704aa30c0e40da7a8d83eef708 t/bigfltpm.t
SHA1 99550df360cd7a07cce39afd142aac112adea6e3 t/bigfltpm.inc
SHA1 adc335657a51b82eeca6cd24a6caa24263283017 t/bigfltpm.t
SHA1 b3ceebc429c05bce95347575d28348306dbcfcc8 t/bigintc.t
SHA1 7954255fd6b3a4a09b6e47c98a1ed79d40a49e22 t/bigintpm.inc
SHA1 0d2491a3abeff02a6e0998cfaaede98a1f993d63 t/bigintpm.inc
SHA1 ba3d855434e4fea04c22bdd54076ed9706a79d5f t/bigintpm.t
SHA1 cb07d195c20eb306088eeacccc2c7475f267446c t/bigints.t
SHA1 0e505ab877fb41505d683163ad3f09027f9eef35 t/biglog.t
......@@ -79,8 +79,8 @@ SHA1 95d41431bb5147f2cd97d2f160c1ce220a365142 t/lib_load.t
SHA1 18071d0caf17979c5345baf7b296a1e95d8f9bf1 t/mbf_ali.t
SHA1 79fafec237d6f47d8a176c67418f94c708ed3fec t/mbi_ali.t
SHA1 2b9490eab4d5371b804a39fb16e77c6bd6bbd006 t/mbi_rand.t
SHA1 38d000d99cb2492ab518786e62ab1fae710e0f8d t/mbimbf.inc
SHA1 b13701babf6c3952a0b8de3803de838d52a13ddc t/mbimbf.t
SHA1 171fffe6a1b291c7c4cd84c1c1ebd48efa420c64 t/mbimbf.inc
SHA1 ec0499541f1915a02637cf7d78b5d28247bee53f t/mbimbf.t
SHA1 a8e152beb9c0583cca8ba397ca2952cf456f107c t/nan_cmp.t
SHA1 852bfc6c25fa982e0c48e270277f091732d062e2 t/new_overloaded.t
SHA1 7b8ad0d8e8bb1afb985d3af119bcd284a2ae105f t/objectify_mbf.t
......@@ -113,11 +113,11 @@ SHA1 01c5bfaa17310e1cea23ad46eacfe1613c291cac t/with_sub.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBAgAGBQJWMj6TAAoJEGcmPl2fr166dAQH/RfhE0u3Rl7TxLyTDikGrPX2
xL21DLsagbLKn705iFqxRiDRzI6lQ/cQEaI37wDeAee6IrABAZW5daFKGJgAv83q
3K+oDFnNfiPHQvmJdlbkvGJw2Xyi8HPrKwDbUifXxPblMPiHVzJT/84o68FYwqrq
CcpkRQ+FgoraH+zW4k9m9FLfTCNkgCioP/WqzZmVp6aRcyyiOdMWQlZQauyKMhSk
YFlcPHaRvJJ8AUS6ktAsX0E+qM7CZo3oINMO1CqzgYZlxZTXklGSKMwA69ymVPMa
C5s1uZM/cjnyK11BVclqoWy/Xyuswagud1WBs2wV7ybTrS4rPMOy20Ye+Musv/w=
=52Ia
iQEcBAEBAgAGBQJWOMJbAAoJEGcmPl2fr166ongH/RTUscTKeeO6W9XL1YAIJpOM
akCBo5Klua7sqLPUOltYjUNix98Td2xOWYatcArDZUUnTQ4oFDt2fJROG7bDWV68
W0yRIrNY7KKqnw8NJ4QL+QERvO9OsflY1QTXSCRrmjqqFOTqF3ujifxZ2NnVSF7C
98RMtn7Mtb7evYpp46ND0L9nFzN76G96bXLSF+7xBWFV7oL1Ru5/CpEJpJLbaIOT
B+xOoj7MxIvCy0zA5WD/Mu9FX7SuIKZbmku5t6hvit5X6f3snRNvhLP/GvpNUEcE
LLKIbqCiB754PoBDqmEnEzK2hfhKFxlvhyuS2G5eoqM3qGBAypEduoW6zi08nHI=
=2wlX
-----END PGP SIGNATURE-----
......@@ -16,7 +16,7 @@ use 5.006002;
use strict;
use warnings;
our $VERSION = '1.999707';
our $VERSION = '1.999708';
require Exporter;
our @ISA = qw/Math::BigInt/;
......@@ -4286,26 +4286,26 @@ functions like so:
=over
=item ffround ( +$scale )
=item bfround ( +$scale )
Rounds to the $scale'th place left from the '.', counting from the dot.
The first digit is numbered 1.
=item ffround ( -$scale )
=item bfround ( -$scale )
Rounds to the $scale'th place right from the '.', counting from the dot.
=item ffround ( 0 )
=item bfround ( 0 )
Rounds to an integer.
=item fround ( +$scale )
=item bround ( +$scale )
Preserves accuracy to $scale digits from the left (aka significant digits)
and pads the rest with zeros. If the number is between 1 and -1, the
significant digits count from the first non-zero after the '.'
=item fround ( -$scale ) and fround ( 0 )
=item bround ( -$scale ) and bround ( 0 )
These are effectively no-ops.
......
......@@ -19,7 +19,7 @@ use 5.006002;
use strict;
use warnings;
our $VERSION = '1.999707';
our $VERSION = '1.999708';
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(objectify bgcd blcm);
......@@ -887,7 +887,7 @@ sub _find_round_parameters
# This procedure finds the round parameters, but it is for speed reasons
# duplicated in round. Otherwise, it is tested by the testsuite and used
# by fdiv().
# by bdiv().
# returns ($self) or ($self,$a,$p,$r) - sets $self to NaN of both A and P
# were requested/defined (locally or globally or both)
......@@ -1003,7 +1003,7 @@ sub round
require Carp; Carp::croak ("Unknown round mode '$r'");
}
# now round, by calling either fround or ffround:
# now round, by calling either bround or bfround:
if (defined $a)
{
$self->bround(int($a),$r) if !defined $self->{_a} || $self->{_a} >= $a;
......@@ -4605,21 +4605,21 @@ versions <= 5.7.2) is like this:
=item Precision
* ffround($p) is able to round to $p number of digits after the decimal
* bfround($p) is able to round to $p number of digits after the decimal
point
* otherwise P is unused
=item Accuracy (significant digits)
* fround($a) rounds to $a significant digits
* only fdiv() and fsqrt() take A as (optional) parameter
+ other operations simply create the same number (fneg etc), or
more (fmul) of digits
* bround($a) rounds to $a significant digits
* only bdiv() and bsqrt() take A as (optional) parameter
+ other operations simply create the same number (bneg etc), or
more (bmul) of digits
+ rounding/truncating is only done when explicitly calling one
of fround or ffround, and never for BigInt (not implemented)
* fsqrt() simply hands its accuracy argument over to fdiv.
of bround or bfround, and never for BigInt (not implemented)
* bsqrt() simply hands its accuracy argument over to bdiv.
* the documentation and the comment in the code indicate two
different ways on how fdiv() determines the maximum number
different ways on how bdiv() determines the maximum number
of digits it should calculate, and the actual code does yet
another thing
POD:
......@@ -4717,22 +4717,22 @@ This is how it works now:
effect, and the other P, this results in an error (NaN).
* A takes precedence over P (Hint: A comes before P).
If neither of them is defined, nothing is used, i.e. the result will have
as many digits as it can (with an exception for fdiv/fsqrt) and will not
as many digits as it can (with an exception for bdiv/bsqrt) and will not
be rounded.
* There is another setting for fdiv() (and thus for fsqrt()). If neither of
A or P is defined, fdiv() will use a fallback (F) of $div_scale digits.
* There is another setting for bdiv() (and thus for bsqrt()). If neither of
A or P is defined, bdiv() will use a fallback (F) of $div_scale digits.
If either the dividend's or the divisor's mantissa has more digits than
the value of F, the higher value will be used instead of F.
This is to limit the digits (A) of the result (just consider what would
happen with unlimited A and P in the case of 1/3 :-)
* fdiv will calculate (at least) 4 more digits than required (determined by
* bdiv will calculate (at least) 4 more digits than required (determined by
A, P or F), and, if F is not used, round the result
(this will still fail in the case of a result like 0.12345000000001 with A
or P of 5, but this can not be helped - or can it?)
* Thus you can have the math done by on Math::Big* class in two modi:
+ never round (this is the default):
This is done by setting A and P to undef. No math operation
will round the result, with fdiv() and fsqrt() as exceptions to guard
will round the result, with bdiv() and bsqrt() as exceptions to guard
against overflows. You must explicitly call bround(), bfround() or
round() (the latter with parameters).
Note: Once you have rounded a number, the settings will 'stick' on it
......@@ -4743,7 +4743,7 @@ This is how it works now:
$x = Math::BigFloat->new(12.34);
$y = Math::BigFloat->new(98.76);
$z = $x * $y; # 1218.6984
print $x->copy()->fround(3); # 12.3 (but A is now 3!)
print $x->copy()->bround(3); # 12.3 (but A is now 3!)
$z = $x * $y; # still 1218.6984, without
# copy would have been 1210!
......@@ -4773,7 +4773,7 @@ This is how it works now:
+ global A
+ global P
+ global F
* fsqrt() will hand its arguments to fdiv(), as it used to, only now for two
* bsqrt() will hand its arguments to bdiv(), as it used to, only now for two
arguments (A and P) instead of one
=item Local settings
......@@ -4787,8 +4787,7 @@ This is how it works now:
=item Rounding
* the rounding routines will use the respective global or local settings.
fround()/bround() is for accuracy rounding, while ffround()/bfround()
is for precision
bround() is for accuracy rounding, while bfround() is for precision
* the two rounding functions take as the second parameter one of the
following rounding modes (R):
'even', 'odd', '+inf', '-inf', 'zero', 'trunc', 'common'
......@@ -4819,7 +4818,7 @@ This is how it works now:
=item Remarks
* The defaults are set up so that the new code gives the same results as
the old code (except in a few cases on fdiv):
the old code (except in a few cases on bdiv):
+ Both A and P are undefined and thus will not be used for rounding
after each operation.
+ round() is thus a no-op, unless given extra parameters A and P
......@@ -4990,20 +4989,20 @@ Examples for rounding:
$y = Math::BigFloat->new(123.456789);
Math::BigFloat->accuracy(4); # no more A than 4
is ($x->copy()->fround(),123.4); # even rounding
print $x->copy()->fround(),"\n"; # 123.4
is ($x->copy()->bround(),123.4); # even rounding
print $x->copy()->bround(),"\n"; # 123.4
Math::BigFloat->round_mode('odd'); # round to odd
print $x->copy()->fround(),"\n"; # 123.5
print $x->copy()->bround(),"\n"; # 123.5
Math::BigFloat->accuracy(5); # no more A than 5
Math::BigFloat->round_mode('odd'); # round to odd
print $x->copy()->fround(),"\n"; # 123.46
$y = $x->copy()->fround(4),"\n"; # A = 4: 123.4
print $x->copy()->bround(),"\n"; # 123.46
$y = $x->copy()->bround(4),"\n"; # A = 4: 123.4
print "$y, ",$y->accuracy(),"\n"; # 123.4, 4
Math::BigFloat->accuracy(undef); # A not important now
Math::BigFloat->precision(2); # P important
print $x->copy()->bnorm(),"\n"; # 123.46
print $x->copy()->fround(),"\n"; # 123.46
print $x->copy()->bround(),"\n"; # 123.46
Examples for converting:
......@@ -5617,15 +5616,15 @@ Mark Biggar, overloaded interface by Ilya Zakharevich, 1996-2001.
=item *
Completely rewritten by Tels L<http://bloodgate.com> in 2001-2008.
Completely rewritten by Tels L<http://bloodgate.com>, 2001-2008.
=item *
Florian Ragwitz L<flora@cpan.org>, 2010.
Florian Ragwitz E<lt>flora@cpan.orgE<gt>, 2010.
=item *
Peter John Acklam, L<pjacklam@online.no>, 2011-.
Peter John Acklam E<lt>pjacklam@online.noE<gt>, 2011-.
=back
......
......@@ -4,7 +4,7 @@ use 5.006002;
use strict;
use warnings;
our $VERSION = '1.999707';
our $VERSION = '1.999708';
# Package to store unsigned big integers in decimal and do math with them
......
......@@ -4,7 +4,7 @@ use 5.006002;
use strict;
use warnings;
our $VERSION = '1.999707';
our $VERSION = '1.999708';
package Math::BigInt;
......
This diff is collapsed.
......@@ -17,7 +17,7 @@ is ($class->config()->{with}, $CL);
# bug #17447: Can't call method Math::BigFloat->bsub, not a valid method
my $c = Math::BigFloat->new( '123.3' );
is ($c->fsub(123), '0.3'); # calling fsub on a BigFloat works
is ($c->bsub(123), '0.3'); # calling bsub on a BigFloat works
# Bug until BigInt v1.86, the scale wasn't treated as a scalar:
$c = Math::BigFloat->new('0.008'); my $d = Math::BigFloat->new(3);
......
......@@ -523,7 +523,8 @@ is (ref($x),'Math::Foo');
# Check numify on non-finite objects.
{
my $inf = 1e99 ** 1e99;
require Math::Complex;
my $inf = Math::Complex::Inf();
my $nan = $inf - $inf;
is($class -> binf("+") -> numify(), $inf, "numify of +Inf");
is($class -> binf("-") -> numify(), -$inf, "numify of -Inf");
......@@ -2432,7 +2433,7 @@ inf:-inf:NaN
+0:2:0
+1:2:1
-1:2:NaN
# -$x ** (1/2) => -$y, but not in froot()
# -$x ** (1/2) => -$y, but not in broot()
-123:2:NaN
+inf:2:inf
-inf:2:NaN
......
......@@ -316,9 +316,9 @@ is ($x->bnot(),-123400); # not -1234001
$x = $mbi->new(-123401); $x->{_a} = 4; is ($x->babs(),123401);
$x = $mbi->new(-123401); $x->{_a} = 4; is ($x->bneg(),123401);
# test fdiv rounding to A and R (bug in v1.48 and maybe earlier versions)
# test bdiv rounding to A and R (bug in v1.48 and maybe earlier versions)
$mbf->round_mode('even');
$x = $mbf->new('740.7')->fdiv('6',4,undef,'zero'); is ($x,'123.4');
$x = $mbf->new('740.7')->bdiv('6',4,undef,'zero'); is ($x,'123.4');
$x = $mbi->new('123456'); $y = $mbi->new('123456'); $y->{_a} = 6;
is ($x->bdiv($y),1); is ($x->{_a},6); # carried over
......
......@@ -63,7 +63,7 @@ foreach my $class (qw/Math::BigInt Math::BigFloat/)
$class->accuracy(undef); # reset for further tests
$class->precision(undef);
}
# bug with flog(Math::BigFloat,Math::BigInt)
# bug with blog(Math::BigFloat,Math::BigInt)
$x = Math::BigFloat->new(100);
$x = $x->blog(Math::BigInt->new(10));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment