summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgregor herrmann <gregoa@debian.org>2022-05-22 00:01:52 +0200
committergregor herrmann <gregoa@debian.org>2022-05-22 00:01:52 +0200
commit5bf74640224ab72e28a4d3f0091b318a607ead21 (patch)
tree0896251fd09b426d4e5bc687edd842e63f48c552
parent2b7ee8a933056f80ac72e7a54702e2d3e720d500 (diff)
New upstream version 1.6011
-rw-r--r--CHANGES4
-rw-r--r--MANIFEST2
-rw-r--r--META.json8
-rw-r--r--META.yml6
-rw-r--r--Makefile.PL2
-rw-r--r--README127
-rw-r--r--README.md10
-rw-r--r--SIGNATURE44
-rw-r--r--lib/Math/BigInt/GMP.pm2
-rw-r--r--t/bigfltpm.inc9
-rw-r--r--t/bigintpm.inc37
-rw-r--r--t/bigintpm.t2
-rw-r--r--t/biglog.t11
-rw-r--r--t/mbimbf.inc10
-rw-r--r--xt/author/lib_load-mbf-mbi.t72
-rw-r--r--xt/author/lib_load-mbi-mbf.t72
16 files changed, 280 insertions, 138 deletions
diff --git a/CHANGES b/CHANGES
index c06809e..0fc05be 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+1.6011 2022-05-17
+
+ * Sync test files with Math-BigInt.
+
1.6010 2021-12-29
* Add static gmp_version() function (code provided by FGasper on GitHub).
diff --git a/MANIFEST b/MANIFEST
index 4212e1e..6ad2a1a 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -141,6 +141,8 @@ xt/author/lib-property-_len.t
xt/author/lib-property-_zeros.t
xt/author/lib.ini
xt/author/lib.t
+xt/author/lib_load-mbf-mbi.t
+xt/author/lib_load-mbi-mbf.t
xt/release/changelog.t
xt/release/cpan-changes.t
xt/release/dist-manifest.t
diff --git a/META.json b/META.json
index ee82f05..c4c4303 100644
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
"Peter John Acklam <pjacklam@gmail.com>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010",
+ "generated_by" : "ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010",
"license" : [
"perl_5"
],
@@ -31,7 +31,7 @@
"runtime" : {
"requires" : {
"Carp" : "1.22",
- "Math::BigInt" : "1.999819",
+ "Math::BigInt" : "1.999831",
"XSLoader" : "0.02",
"perl" : "5.008"
}
@@ -50,6 +50,6 @@
"web" : "https://github.com/pjacklam/p5-Math-BigInt-GMP"
}
},
- "version" : "1.6010",
- "x_serialization_backend" : "JSON::PP version 4.04"
+ "version" : "1.6011",
+ "x_serialization_backend" : "JSON::PP version 4.08"
}
diff --git a/META.yml b/META.yml
index b5f087f..bfefc33 100644
--- a/META.yml
+++ b/META.yml
@@ -7,7 +7,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: '6.58'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010'
+generated_by: 'ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -19,10 +19,10 @@ no_index:
- inc
requires:
Carp: '1.22'
- Math::BigInt: '1.999819'
+ Math::BigInt: '1.999831'
XSLoader: '0.02'
perl: '5.008'
resources:
repository: https://github.com/pjacklam/p5-Math-BigInt-GMP.git
-version: '1.6010'
+version: '1.6011'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff --git a/Makefile.PL b/Makefile.PL
index 6ef43d2..dd7fd09 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -36,7 +36,7 @@ WriteMakefile
# A hash of modules that are needed to run the module.
'PREREQ_PM' => {
- 'Math::BigInt' => 1.999819,
+ 'Math::BigInt' => 1.999831,
'Carp' => 1.22,
'XSLoader' => 0.02,
},
diff --git a/README b/README
index 16a4c30..7c3c34b 100644
--- a/README
+++ b/README
@@ -1,97 +1,84 @@
-Math-BigInt-GMP
+NAME
+ Math::BigInt::GMP - backend library for Math::BigInt etc. based on GMP
-Math::BigInt::GMP is a replacement library for Math::BigInt::Calc that
-reimplements some of the Math::BigInt::Calc functions in XS. It can be used
-via:
+SYNOPSIS
+ # to use it with Math::BigInt
+ use Math::BigInt lib => 'GMP';
- use Math::BigInt lib => 'GMP';
+ # to use it with Math::BigFloat
+ use Math::BigFloat lib => 'GMP';
-This package contains a replacement (drop-in) module for Math::BigInt's core,
-Math::BigInt::Calc.pm.
+ # to use it with Math::BigRat
+ use Math::BigRat lib => 'GMP';
-INSTALLATION
+DESCRIPTION
+ Math::BigInt::GMP is a backend library for Math::BigInt, Math::BigFloat,
+ Math::BigRat and related modules.
-You need to install the Gnu MP library aka libgmp to compile this module.
+ Math::BigInt::GMP provides support for big integer calculations by means
+ of the GMP C library. See <https://gmplib.org/> for more information
+ about the GMP library.
-How to install (replace the version below with the current one):
+ Math::BigInt::GMP no longer uses Math::GMP, but provides its own XS
+ layer to access the GMP C library. This cuts out another (Perl
+ subroutine) layer and also reduces the memory footprint.
- tar -xzf Math-BigInt-GMP-1.12.tar.gz
- cpansign --verify
+ Math::BigInt::GMP inherits from Math::BigInt::Lib.
-If the signature does not verify ok, you might to install Module::Signature.
-If the signature still does not verify okay, notify me. DO NO INSTALL this
-package when the signature is BAD - your system might get compromised!
+STATIC FUNCTIONS
+ $str = gmp_version();
+ Returns the underlying GMP library's version as a string, e.g., 6.2.1.
-If the signature is good, do:
-
- perl Makefile.PL
- make
- make test
- make install
-
-If you have trouble compiling this package because the GMP library is
-installed in a non-standard location, try to pass the INC and LIBS
-arguments to Makefile.PL with the appropriate information. Here
-is an example:
-
- perl Makefile.PL\
- INC="-I/apps/perl588/site/gmp-4.2.1/include"\
- LIBS="-L/apps/perl588/site/gmp-4.2.1/lib -lgmp"
-
-To use this module, replace:
-
- use Math::BigInt;
-
-with this:
-
- use Math::BigInt lib => 'GMP';
-
-or alternatively something like:
-
- use Math::BigInt lib => 'GMP,Pari,FastCalc';
-
-Please read the documentation under PERFORMANCE in Math::BigInt on when to use
-this module and when not. As of v1.10 and Math::BigInt v1.64/v1.64, using "lib
-=> 'GMP'" will actually reduce the memory consumption of your program, and
-thanks to the fact that we no longer use Math::GMP but have our own XS code,
-almost all operations should be faster than just using Calc (the default
-pure-perl library used in Math::BigInt).
-
-So, the following:
-
- use Math::BigInt lib => 'GMP';
-
-can be heartily recommended.
+BUGS
+ Please report any bugs or feature requests to "bug-math-bigint-gmp at
+ rt.cpan.org", or through the web interface at
+ <https://rt.cpan.org/Ticket/Create.html?Queue=Math-BigInt-GMP> (requires
+ login). We will be notified, and then you'll automatically be notified
+ of progress on your bug as I make changes.
SUPPORT
+ After installing, you can find documentation for this module with the
+ perldoc command.
-After installing, you can find documentation for this module with the
-perldoc command.
+ perldoc Math::BigInt::GMP
- perldoc Math::BigInt::GMPz
-
-You can also look for information at:
+ You can also look for information at:
GitHub
- https://github.com/pjacklam/p5-Math-BigInt-GMPz
+ <https://github.com/pjacklam/p5-Math-BigInt-GMP>
RT: CPAN's request tracker
- https://rt.cpan.org/Dist/Display.html?Name=Math-BigInt-GMPz
+ <https://rt.cpan.org/Dist/Display.html?Name=Math-BigInt-GMP>
MetaCPAN
- https://metacpan.org/release/Math-BigInt-GMPz
+ <https://metacpan.org/release/Math-BigInt-GMP>
CPAN Testers Matrix
- http://matrix.cpantesters.org/?dist=Math-BigInt-GMPz
+ <http://matrix.cpantesters.org/?dist=Math-BigInt-GMP>
CPAN Ratings
- https://cpanratings.perl.org/dist/Math-BigInt-GMPz
+ <https://cpanratings.perl.org/dist/Math-BigInt-GMP>
+
+LICENSE
+ This program is free software; you may redistribute it and/or modify it
+ under the same terms as Perl itself.
+
+AUTHORS
+ Tels <http://bloodgate.com/> in 2001-2007.
+
+ Thanks to Chip Turner (CHIPT on CPAN) for providing Math::GMP, which was
+ inspiring my work.
+
+ Maintained by Peter John Acklam <pjacklam@gmail.com> 2010-2021.
+
+ gmp_version() provided by FGasper on GitHub.
-COPYRIGHT AND LICENCE
+SEE ALSO
+ Math::BigInt::Lib for a description of the API.
-Tels http://bloodgate.com/, 2001-2007.
+ Alternative libraries Math::BigInt::Calc, Math::BigInt::FastCalc, and
+ Math::BigInt::Pari.
-Peter John Acklam pjacklam@gmail.com, 2010-2021
+ Some of the modules that use these libraries Math::BigInt,
+ Math::BigFloat, and Math::BigRat.
-This program is free software; you can redistribute it and/or modify it
-under the same terms as Perl itself.
diff --git a/README.md b/README.md
index 948e6f2..7c7c6a7 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,12 @@ also reduces the memory footprint.
Math::BigInt::GMP inherits from Math::BigInt::Lib.
+# STATIC FUNCTIONS
+
+## $str = gmp\_version();
+
+Returns the underlying GMP library's version as a string, e.g., `6.2.1`.
+
# BUGS
Please report any bugs or feature requests to
@@ -70,7 +76,7 @@ You can also look for information at:
This program is free software; you may redistribute it and/or modify it under
the same terms as Perl itself.
-# AUTHOR
+# AUTHORS
Tels &lt;http://bloodgate.com/> in 2001-2007.
@@ -79,6 +85,8 @@ inspiring my work.
Maintained by Peter John Acklam <pjacklam@gmail.com> 2010-2021.
+gmp\_version() provided by FGasper on GitHub.
+
# SEE ALSO
[Math::BigInt::Lib](https://metacpan.org/pod/Math%3A%3ABigInt%3A%3ALib) for a description of the API.
diff --git a/SIGNATURE b/SIGNATURE
index f6f170f..46a5d68 100644
--- a/SIGNATURE
+++ b/SIGNATURE
@@ -1,5 +1,5 @@
This file contains message digests of all files listed in MANIFEST,
-signed via the Module::Signature module, version 0.87.
+signed via the Module::Signature module, version 0.88.
To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
@@ -15,36 +15,36 @@ not run its Makefile.PL or Build.PL.
Hash: RIPEMD160
SHA256 b173bc6027df00777c94cc36850ef64f7b2affeb8ec85593fee91eff5ce4a899 BUGS
-SHA256 f3427654e411f6cc40fa5e2a765aa9f9aa123396fe4fb2d80789e33cd7319d83 CHANGES
+SHA256 edf03f70b3e984b4e6e71045630a8682e090cfb0d0a6c1e3e8f7b3938d7b66de CHANGES
SHA256 15123cad594aefe6f9f78a0b637ba685991f36865f561686d57c61b13eca1ae0 CREDITS
SHA256 7ddda45c10ba55b6713c512b418d706278b1e260e94008d599b2709cbfa166d0 GMP.xs
SHA256 b857edab549ac6893e2df5e1ec768ee46b62bcf1607a55e876f4d23f079eacce LICENSE
-SHA256 26b3fcba3477909da1452f7fb10bf5fc6752908472aa970df9a5b818b59884e4 MANIFEST
+SHA256 283a887525057e82bc986996c36c5aef1919f12e46fbb14f192295b6800fafdc MANIFEST
SHA256 cea319b25473049674f5cc8c9bfa5b90f0b78383d4af657b8cf4bdd9ea4dd40c MANIFEST.SKIP
-SHA256 a27a2cc39230171c7de1d872c8d69405a6492a8ff56c7f16115656da3c242c7c META.json
-SHA256 9d62ec76ab18bd1c7f86f8acc5f43f05aa9f78d793876839e3ee744a11a28e06 META.yml
-SHA256 ffff83ecd9c27a6c909db54f1d7317501a38113b867c1cdf68e3490fd81ac125 Makefile.PL
-SHA256 e4d5a5da3389cd179074d97e0513cbbce4b8087e682d33564cec6402eb36bd7e README
-SHA256 3b3c6db5a3747f5e1400a18f0b1b1af03e79dd34daf70870f9f824e0a7b57ad5 README.md
+SHA256 fc823668d5c529f8b217e73a0fa2000db33e3d4d71b7c4cc989ad699b9d1d8cf META.json
+SHA256 0a1f99f7ed75be475edd65dc76fe0d5d873722223d309f5f1aadbc031ada3699 META.yml
+SHA256 e8592004f459312c7a6f2715482533bda5c57a950008c7f6931dbb012ab11017 Makefile.PL
+SHA256 29860c37d5c1b8260c51206c28b7580ae6b03df165e2ec266db5d2f373a8a80e README
+SHA256 cc43859594b7bd2e14bb5ada4c8a01c437010283d4fddd92d86191d109010f78 README.md
SHA256 672c89aacd483edd14cbe5ee7db5dfa2991addad05f0d920d2424dfe507592f0 TODO
SHA256 ceed5e08784e849958f8aa74c536c008ad89cdce1612571ee38321293fc91250 build/README
SHA256 9850d025676d6bd49c4703ae2091f95266cf457a5b033f457b9cf073f6a2c33f build/leak.pl
SHA256 fbe60701f97bf64e468ebaae5fb4805409a61fa71793133d14909e0b9733e9fc build/leaktest
SHA256 7ac0dbf02aa5f9fffd64599358320f60388e95de64f9ae7a6d718cf224a0b433 inc/Devel/CheckLib.pm
-SHA256 1bef889f8c17301d1f079f4e0dac3f1cd530744dd33b97fe8adcd09a20a32c2b lib/Math/BigInt/GMP.pm
+SHA256 c43ddedfeb13c0d7c2f1958639ecc53789502bd33d9a4943bdd15244cc1dd178 lib/Math/BigInt/GMP.pm
SHA256 f855e68d0f171debf8369ead8b36d004188f1c9069287a0d3c67a87f9afb1312 t/00sig.t
SHA256 774a5b7aa7e0da4d3fd19849dad45e3519406447732c3ad3441a48508739ed33 t/01load.t
SHA256 9567333ab26747265ddf9bbcda1d6a672b71c6e85eb2cad3021ba7d2f96eb1c1 t/Math/BigInt/Lib/TestUtil.pm
-SHA256 6ad718e94313ff7353c8a81a16199f0803746db009551e5cfe91c8da4dc3da92 t/bigfltpm.inc
+SHA256 b5f6aacf13dc567671170a4086a03c43143af31b3596542e521464c5db19bba1 t/bigfltpm.inc
SHA256 ba90ef638a3c5cd2be536e53144c37687d49c213bf3e0945c966012a6395fbf7 t/bigfltpm.t
SHA256 b4c6c2c6539673ca4317d1edf14d0088d975c0c27ebe409f773a3b390d509d71 t/bigintg.t
-SHA256 f9904c1bd689faf738846920df51ec1c1c18e64ad9679bebe310009625931609 t/bigintpm.inc
-SHA256 7c3bb0e6f53a53d394963fb8fb12e1b628929401ffcde4de68ea8105b44520a7 t/bigintpm.t
-SHA256 3f7c0c0fe18d52f835ce251da601ea711acc8461e745284569c0db690b7770df t/biglog.t
+SHA256 4a27c4823323437af76bce2b33e6147891bfb5d0e0bb9d3dbc5e70931bc62882 t/bigintpm.inc
+SHA256 3f2f7ace432bf43336f143602aed02f30247df2f45cba918ce55f55529d66be0 t/bigintpm.t
+SHA256 2c9176d4f4ade203eabc81baeb3d51bc13370da33292335f3fc073c35fbe280e t/biglog.t
SHA256 b8af8e548686d7132b27fad6f115a1b5c7b938260351a0a8233a4c6d6d824c99 t/bigroot.t
SHA256 d918b6df34003214403c8dc86f7da70700ad29af8a8e9dc53540dc1e83b41351 t/mbi-from-big-scalar.t
SHA256 1cb05e56f537b9e4020e64e5d679d84af8cb8c6f1dd30cd0bef2080626d23959 t/mbi_rand.t
-SHA256 f65ac3022afe737a5bc24048fe5eaffcd3c9138427ad5180d8e97ce4e48562be t/mbimbf.inc
+SHA256 38b8514632ee9b9190862914678406bd4861c2b808d2eb4f3333d509066a74a8 t/mbimbf.inc
SHA256 3cdfdd022b39ff8464a85038cf3cef1dd9707ef4f9a1d56fdfab223886521926 t/mbimbf.t
SHA256 bf013505c2786529e733c6b86b8a2b82c2bb9fba72a2d74c469b8fa41baa0dd1 t/storable.t
SHA256 c5da85d3c88dc2e8aa40e2cced0c564428d7dc3e0bb17498b080a0853a461cdb t/threads.t
@@ -159,6 +159,8 @@ SHA256 d39cb7dc01f97ae1c4334d675456eab72a6396d93d77322b90c7fba08f06fca4 xt/autho
SHA256 cf92c7351c227cd056534ec0deab83ea5dc5fca3db7b9c49416abe55b17bf32d xt/author/lib-property-_zeros.t
SHA256 e082a85c4ca2c36a5f56683126ddb902e96de831dbb4558752e070739d7c3fff xt/author/lib.ini
SHA256 6816b75d56f07bf2f6fcb7805bfb2a039138eec06ec8f1a2ad449601cc200d8d xt/author/lib.t
+SHA256 cef6083a4cd49fec0c881193f17f30f0b0d265d578809e66c8b10a4e5703b8e0 xt/author/lib_load-mbf-mbi.t
+SHA256 26e8ea11db97c085e5b6828cf6f870631a853803b570494d823cc985c21a29ba xt/author/lib_load-mbi-mbf.t
SHA256 5f8a8c4fb65028029b2cb51ec12aebd9d1d0b44ac6a48a31f5a8c1500aa27d15 xt/release/changelog.t
SHA256 a37a38d9b507b98f55a17efc4f2fd54e4c45e20ec2cb5067606a4501dd634494 xt/release/cpan-changes.t
SHA256 befb07cbace153e844bd1aa24309e8136f0265cc97708bfb2f5f427964f7a88d xt/release/dist-manifest.t
@@ -174,11 +176,11 @@ SHA256 334ef06155ec886e4592639219b0227e330d969019a9ac25e0c633e4be1b38f3 xt/relea
SHA256 79e228dfe3193c0f2b5f9afaa6677062ef33ac9c9578e0e6c5a627696c319982 xt/release/version.t
-----BEGIN PGP SIGNATURE-----
-iQEcBAEBAwAGBQJhzYE9AAoJEGcmPl2fr166ecEH/1qJdaNncfjDDGXVFyHU5ve2
-iSrHvhvey66CQC+Tt4JaT7KfBndGZZ0VubM4RFkyEMuNCtqS/17JZ6E0D7H067vm
-FnkANtvB9mYAiX3a5VC89Aelr4uZ178m5pxSvb391vxGcJ1om22XmTpjBvl0k/gi
-GyAfI6lXT+MTmvVAo7mp7ZDv9HiEeeeRTklAQT5YQXiktwTjMSHDx7bm0BbRNnwc
-sePU+ypX1wLn8vIOlT82DKm9eo4SnzmkSWRIeSjIwuK/R3llGq+G4UViRygsOWZP
-YZKeB+3Y4o7o/YZzztKniUIh81b0ra9gY5/RMSd+Rtu42IJEr7XW1QbCePnbYXY=
-=ZJru
+iQEcBAEBAwAGBQJig6sKAAoJEGcmPl2fr166LHUH/A0lO6EeffyerILXzgmhXjGK
+8GM990EKmbhswVC2J1mggcP3ulDas1e44NAvgLcwTAmoMT8ZVxpBbNvpxDZkFUxl
+CfcWWaHBBBFzWA+XkwAriNv05XZBuYknRVkndvjx4hMIpI1vt5npoMtO6/UJGNHA
+5pDe1mGGQ2kXiWsrutZEwlW5HjY3Ay9yHsZfPym20NWMo5YH9K+rPwKrj33lMJt6
+VTMzkTdERetyllyICVbhws+VNAIDMDtxp2We3Vdfx8cGkMGgEsAmbYWfGynaWaEU
+IiNFPuu3g7wxR99phPMfwMFTelOZYL5BfQ/xNd8NGHjBAswB7UEILu/39xLDrYg=
+=5CGK
-----END PGP SIGNATURE-----
diff --git a/lib/Math/BigInt/GMP.pm b/lib/Math/BigInt/GMP.pm
index 0a62cb5..63b707c 100644
--- a/lib/Math/BigInt/GMP.pm
+++ b/lib/Math/BigInt/GMP.pm
@@ -8,7 +8,7 @@ use Math::BigInt::Lib 1.999801;
our @ISA = qw< Math::BigInt::Lib >;
-our $VERSION = '1.6010';
+our $VERSION = '1.6011';
use XSLoader;
XSLoader::load "Math::BigInt::GMP", $VERSION;
diff --git a/t/bigfltpm.inc b/t/bigfltpm.inc
index 0b25505..bd7e285 100644
--- a/t/bigfltpm.inc
+++ b/t/bigfltpm.inc
@@ -44,7 +44,8 @@ while (<DATA>) {
} elsif ($f eq "binf") {
$try .= qq| \$x->binf("$args[1]");|;
} elsif ($f eq "bone") {
- $try .= qq| \$x->bone("$args[1]");|;
+ $try .= length($args[1]) ? qq| \$x->bone("$args[1]");|
+ : qq| \$x->bone();|;
} elsif ($f eq "bstr") {
$try .= qq| \$x->accuracy($args[1]); \$x->precision($args[2]);|;
$try .= ' $x->bstr();';
@@ -524,8 +525,8 @@ NaN:10:NaN
-inf:10:NaN
1.2:10:0.3623577545
2.4:12:-0.737393715541
-0:10:1
-0:20:1
+0:10:1.000000000
+0:20:1.0000000000000000000
1:10:0.5403023059
1:12:0.540302305868
@@ -867,7 +868,7 @@ abc:NaN
0::1
-2::1
abc::1
-2:abc:1
+2::1
&bsstr
+inf:inf
diff --git a/t/bigintpm.inc b/t/bigintpm.inc
index 61d3ab2..ae029a2 100644
--- a/t/bigintpm.inc
+++ b/t/bigintpm.inc
@@ -1415,13 +1415,12 @@ abc:NaN
2:-:-1
invalid:-:-1
invalid:+:1
-2:abc:1
3::1
&binf
1:+:inf
2:-:-inf
-3:abc:inf
+3:+inf:inf
&is_nan
123:0
@@ -3359,23 +3358,6 @@ $round_mode("odd")
#-501234500:-4:-501235000
+12345000:4:12350000
-12345000:4:-12350000
-$round_mode("even")
-+60123456789:5:60123000000
--60123456789:5:-60123000000
-+60123456789:9:60123456800
--60123456789:9:-60123456800
-+601234500:6:601234000
--601234500:6:-601234000
-#+601234500:-4:601234000
-#-601234500:-4:-601234000
-#-601234500:-9:0
-#-501234500:-9:0
-#-601234500:-8:0
-#-501234500:-8:0
-+1234567:7:1234567
-+1234567:6:1234570
-+12345000:4:12340000
--12345000:4:-12340000
$round_mode("common")
+60123456789:5:60123000000
+60123199999:5:60123000000
@@ -3397,6 +3379,23 @@ $round_mode("common")
-60123700000:5:-60124000000
-60123800000:5:-60124000000
-60123900000:5:-60124000000
+$round_mode("even")
++60123456789:5:60123000000
+-60123456789:5:-60123000000
++60123456789:9:60123456800
+-60123456789:9:-60123456800
++601234500:6:601234000
+-601234500:6:-601234000
+#+601234500:-4:601234000
+#-601234500:-4:-601234000
+#-601234500:-9:0
+#-501234500:-9:0
+#-601234500:-8:0
+#-501234500:-8:0
++1234567:7:1234567
++1234567:6:1234570
++12345000:4:12340000
+-12345000:4:-12340000
&is_zero
0:1
diff --git a/t/bigintpm.t b/t/bigintpm.t
index 13d82f0..e2f8027 100644
--- a/t/bigintpm.t
+++ b/t/bigintpm.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 4280 # tests in require'd file
+use Test::More tests => 4278 # tests in require'd file
+ 20; # tests in this file
use Math::BigInt only => 'GMP';
diff --git a/t/biglog.t b/t/biglog.t
index 78abf8b..ae5be59 100644
--- a/t/biglog.t
+++ b/t/biglog.t
@@ -36,7 +36,6 @@ is($class->new(2)->bexp(), '7', "$class->new(2)->bexp()");
is($class->new(3)->bexp(), '20', "$class->new(3)->bexp()");
###############################################################################
-###############################################################################
# Math::BigFloat tests
###############################################################################
@@ -146,7 +145,7 @@ is($class->new("10")->bpow("0.6", 10), "3.981071706",
qq|$class->new("10")->bpow("0.6", 10)|);
# blog should handle bigint input
-is(Math::BigFloat::blog(Math::BigInt->new(100), 10), 2, "blog(100)");
+is(Math::BigFloat->blog(Math::BigInt->new(100), 10), 2, "blog(100)");
###############################################################################
# some integer results
@@ -190,9 +189,9 @@ test_bpow('9.86902225', '0.5', undef, '3.1415');
test_bpow('0.2', '0.41', 10, '0.5169187652');
-is($class->new("0.01")->bpow("28.4", 40)->bsstr(),
- '1584893192461113485202101373391507013269e-96',
- qq|$class->new("0.01")->bpow("28.4", 40)->bsstr()|);
+is($class->new("0.1")->bpow("28.4", 40)->bsstr(),
+ '3981071705534972507702523050877520434877e-68',
+ qq|$class->new("0.1")->bpow("28.4", 40)->bsstr()|);
# The following test takes too long.
#is($class->new("2")->bpow("-1034.5", 40)->bsstr(),
@@ -231,8 +230,6 @@ is($class->new("-394.84010945715266885")->bexp(20)->bsstr(),
# all done
-1;
-
###############################################################################
sub test_bpow {
diff --git a/t/mbimbf.inc b/t/mbimbf.inc
index 7a52d73..c3b458f 100644
--- a/t/mbimbf.inc
+++ b/t/mbimbf.inc
@@ -417,17 +417,15 @@ $x = $mbi->new(123400);
$x->{_a} = 4;
is($x->bnot(), -123400, q|$x->bnot()|); # not -1234001
-# both babs() and bneg() don't need to round, since the input will already
-# be rounded (either as $x or via new($string)), and they don't change the
-# value. The two tests below peek at this by using _a (illegally) directly
+# to be consistent with other methods, babs() and bneg() also support rounding
$x = $mbi->new(-123401);
$x->{_a} = 4;
-is($x->babs(), 123401, q|$x->babs()|);
+is($x->babs(), 123400, q|$x->babs()|);
$x = $mbi->new(-123401);
$x->{_a} = 4;
-is($x->bneg(), 123401, q|$x->bneg()|);
+is($x->bneg(), 123400, q|$x->bneg()|);
# test bdiv rounding to A and R (bug in v1.48 and maybe earlier versions)
@@ -1293,7 +1291,7 @@ while (<DATA>) {
$try .= qq| \$y->accuracy($ya);| if $ya ne '';
$try .= qq| \$y->precision($yp);| if $yp ne '';
- $try .= ' $x->$f($y);';
+ $try .= ' $x->' . $f . '($y);';
# print "trying $try\n";
$rc = eval $try;
diff --git a/xt/author/lib_load-mbf-mbi.t b/xt/author/lib_load-mbf-mbi.t
new file mode 100644
index 0000000..e18476e
--- /dev/null
+++ b/xt/author/lib_load-mbf-mbi.t
@@ -0,0 +1,72 @@
+# -*- mode: perl; -*-
+
+use strict;
+use warnings;
+
+use Test::More tests => 10;
+
+use lib "t";
+
+# First load Math::BigFloat with Math::BigInt::Calc.
+
+use Math::BigFloat lib => "Calc";
+
+is(Math::BigFloat -> config("lib"), "Math::BigInt::Calc",
+ 'Math::BigFloat -> config("lib")');
+
+is(ref Math::BigFloat -> bzero() -> {_m}, "Math::BigInt::Calc",
+ 'ref Math::BigFloat -> bzero() -> {_m}');
+
+# Math::BigInt will know that we loaded Math::BigInt::Calc.
+
+require Math::BigInt;
+
+is(Math::BigInt -> config("lib"), "Math::BigInt::Calc",
+ 'Math::BigInt -> config("lib")');
+
+is(ref Math::BigInt -> bzero() -> {value}, "Math::BigInt::Calc",
+ "ref Math::BigInt -> bzero() -> {value}");
+
+# Now load Math::BigFloat again with a different lib.
+
+Math::BigFloat -> import(lib => "BareCalc");
+
+is(Math::BigFloat -> config("lib"), "Math::BigInt::Calc",
+ 'Math::BigFloat -> config("lib")');
+
+is(ref Math::BigFloat -> bzero() -> {_m}, "Math::BigInt::Calc",
+ 'ref Math::BigFloat -> bzero() -> {_m}');
+
+# See if Math::BigInt knows about Math::BigInt::BareCalc.
+
+is(Math::BigInt -> config("lib"), "Math::BigInt::Calc",
+ "Math::BigInt is using library Math::BigInt::Calc");
+
+is(ref Math::BigInt -> bzero() -> {value}, "Math::BigInt::Calc",
+ "ref Math::BigInt -> bzero() -> {value}");
+
+# See that Math::BigInt supports "only".
+
+eval { Math::BigInt -> import("only" => "Calc") };
+subtest 'Math::BigInt -> import("only" => "Calc")' => sub {
+ plan tests => 3;
+
+ is($@, "", '$@ is empty');
+ is(Math::BigInt -> config("lib"), "Math::BigInt::Calc",
+ 'Math::BigInt -> config("lib")');
+ is(ref Math::BigInt -> bzero() -> {value}, "Math::BigInt::Calc",
+ "ref Math::BigInt -> bzero() -> {value}");
+};
+
+# See that Math::BigInt supports "try".
+
+eval { Math::BigInt -> import("try" => "BareCalc") };
+subtest 'Math::BigInt -> import("try" => "BareCalc")' => sub {
+ plan tests => 3;
+
+ is($@, "", '$@ is empty');
+ is(Math::BigInt -> config("lib"), "Math::BigInt::Calc",
+ 'Math::BigInt -> config("lib")');
+ is(ref Math::BigInt -> bzero() -> {value}, "Math::BigInt::Calc",
+ "ref Math::BigInt -> bzero() -> {value}");
+}
diff --git a/xt/author/lib_load-mbi-mbf.t b/xt/author/lib_load-mbi-mbf.t
new file mode 100644
index 0000000..8868667
--- /dev/null
+++ b/xt/author/lib_load-mbi-mbf.t
@@ -0,0 +1,72 @@
+# -*- mode: perl; -*-
+
+use strict;
+use warnings;
+
+use Test::More tests => 10;
+
+use lib "t";
+
+# First load Math::BigInt with Math::BigInt::Calc.
+
+use Math::BigInt lib => "Calc";
+
+is(Math::BigInt -> config("lib"), "Math::BigInt::Calc",
+ 'Math::BigInt -> config("lib")');
+
+is(ref Math::BigInt -> bzero() -> {value}, "Math::BigInt::Calc",
+ 'ref Math::BigInt -> bzero() -> {value}');
+
+# Math::BigFloat will know that we loaded Math::BigInt::Calc.
+
+require Math::BigFloat;
+
+is(Math::BigFloat -> config("lib"), "Math::BigInt::Calc",
+ 'Math::BigFloat -> config("lib")');
+
+is(ref Math::BigFloat -> bzero() -> {_m}, "Math::BigInt::Calc",
+ "ref Math::BigFloat -> bzero() -> {_m}");
+
+# Now load Math::BigInt again with a different lib.
+
+Math::BigInt -> import(lib => "BareCalc");
+
+is(Math::BigInt -> config("lib"), "Math::BigInt::Calc",
+ 'Math::BigInt -> config("lib")');
+
+is(ref Math::BigInt -> bzero() -> {value}, "Math::BigInt::Calc",
+ 'ref Math::BigInt -> bzero() -> {value}');
+
+# See if Math::BigFloat knows about Math::BigInt::BareCalc.
+
+is(Math::BigFloat -> config("lib"), "Math::BigInt::Calc",
+ "Math::BigFloat is using library Math::BigInt::Calc");
+
+is(ref Math::BigFloat -> bzero() -> {_m}, "Math::BigInt::Calc",
+ "ref Math::BigFloat -> bzero() -> {_m}");
+
+# See that Math::BigFloat supports "only".
+
+eval { Math::BigFloat -> import("only" => "Calc") };
+subtest 'Math::BigFloat -> import("only" => "Calc")' => sub {
+ plan tests => 3;
+
+ is($@, "", '$@ is empty');
+ is(Math::BigFloat -> config("lib"), "Math::BigInt::Calc",
+ 'Math::BigFloat -> config("lib")');
+ is(ref Math::BigFloat -> bzero() -> {_m}, "Math::BigInt::Calc",
+ "ref Math::BigFloat -> bzero() -> {_m}");
+};
+
+# See that Math::BigFloat supports "try".
+
+eval { Math::BigFloat -> import("try" => "BareCalc") };
+subtest 'Math::BigFloat -> import("try" => "BareCalc")' => sub {
+ plan tests => 3;
+
+ is($@, "", '$@ is empty');
+ is(Math::BigFloat -> config("lib"), "Math::BigInt::Calc",
+ 'Math::BigFloat -> config("lib")');
+ is(ref Math::BigFloat -> bzero() -> {_m}, "Math::BigInt::Calc",
+ "ref Math::BigFloat -> bzero() -> {_m}");
+}