Projects
openEuler:Mainline
perl-bignum
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 10
View file
_service:tar_scm:perl-bignum.spec
Changed
@@ -1,6 +1,6 @@ Name: perl-bignum -Version: 0.63 -Release: 2 +Version: 0.66 +Release: 1 Summary: transparent big number support License: GPL or Artistic URL: https://metacpan.org/release/bignum @@ -12,15 +12,16 @@ #for test BuildRequires: perl(Test::More) >= 0.88 -Requires: perl(:MODULE_COMPAT_%(perl -V:version | cut -d"'" -f 2)) perl(Carp) +Requires: perl(:MODULE_COMPAT_%(perl -V:version | cut -d"'" -f 2)) perl(Carp) >= 1.22 #for test -Requires: perl(Math::BigRat) >= 0.2618 perl(Math::BigInt) >= 1.999825 +Requires: perl(Math::BigRat) >= 0.2623 perl(Math::BigInt) >= 1.999830 %description Three modules provided by this package: * bigint - Transparent BigInteger support for Perl * bignum - Transparent BigNumber support for Perl * bigrat - Transparent BigNumber/BigRational support for Perl + * bigfloat - Transparent big floating point number support for Perl %package_help @@ -48,6 +49,9 @@ %{_mandir}/man3/* %changelog +* Fri Jul 28 2023 renhongxun <renhongxun@h-partners.com> 0.66-1 +- upgrade version to 0.66 + * Tue Oct 25 2022 renhongxun <renhongxun@h-partners.com> 0.63-2 - Rebuild for next release
View file
_service:tar_scm:bignum-0.63.tar.gz/t/infnan-bignum.t
Deleted
@@ -1,100 +0,0 @@ -# -*- mode: perl; -*- - -use strict; -use warnings; - -use Test::More tests => 66; - -use bignum; - -my $class = "Math::BigFloat"; -my $x; - -############################################################################### - -note("inf tests"); - -$x = 1 + inf; -note("\n\n" . $x . "\n\n"); - -$x = 1 + inf; -is(ref($x), $class, "\$x = 1 + inf makes a $class"); -is($x->bstr(), "inf", '$x = 1 + inf; $x->bstr() = "inf"'); - -$x = 1 * inf; -is(ref($x), $class, "\$x = 1 * inf makes a $class"); -is($x->bstr(), "inf", '$x = 1 * inf; $x->bstr() = "inf"'); - -# these don't work without exporting inf() -$x = inf; -is(ref($x), $class, "\$x = inf makes a $class"); -is($x->bstr(), "inf", '$x = inf; $x->bstr() = "inf"'); - -$x = inf + inf; -is(ref($x), $class, "\$x = inf + inf makes a $class"); -is($x->bstr(), "inf", '$x = inf + inf; $x->bstr() = "inf"'); - -$x = inf * inf; -is(ref($x), $class, "\$x = inf * inf makes a $class"); -is($x->bstr(), "inf", '$x = inf * inf; $x->bstr() = "inf"'); - -############################################################################### - -note("NaN tests"); - -$x = 1 + NaN; -is(ref($x), $class, "\$x = 1 + NaN makes a $class"); -is($x->bstr(), "NaN", '$x = 1 + NaN; $x->bstr() = "NaN"'); - -$x = 1 * NaN; -is(ref($x), $class, "\$x = 1 * NaN makes a $class"); -is($x->bstr(), "NaN", '$x = 1 * NaN; $x->bstr() = "NaN"'); - -# these don't work without exporting NaN() -$x = NaN; -is(ref($x), $class, "\$x = NaN makes a $class"); -is($x->bstr(), "NaN", '$x = NaN; $x->bstr() = "NaN"'); - -$x = NaN + NaN; -is(ref($x), $class, "\$x = NaN + NaN makes a $class"); -is($x->bstr(), "NaN", '$x = NaN + NaN; $x->bstr() = "NaN"'); - -$x = NaN * NaN; -is(ref($x), $class, "\$x = NaN * NaN makes a $class"); -is($x->bstr(), "NaN", '$x = NaN * NaN; $x->bstr() = "NaN"'); - -############################################################################### - -note("mixed tests"); - -# these don't work without exporting NaN() or inf() - -$x = NaN + inf; -is(ref($x), $class, "\$x = NaN + inf makes a $class"); -is($x->bstr(), "NaN", '$x = NaN + inf; $x->bstr() = "NaN"'); - -$x = NaN * inf; -is(ref($x), $class, "\$x = NaN * inf makes a $class"); -is($x->bstr(), "NaN", '$x = NaN * inf; $x->bstr() = "NaN"'); - -$x = inf * NaN; -is(ref($x), $class, "\$x = inf * NaN makes a $class"); -is($x->bstr(), "NaN", '$x = inf * NaN; $x->bstr() = "NaN"'); - -############################################################################### -# inf and NaN as strings. - -for my $nan (qw/ nan naN nAn nAN Nan NaN NAn NAN /) { - my $x = 1 + $nan; - is($x->bstr(), "NaN", qq|\$x = 1 + "$nan"|); - is(ref($x), $class, "\$x is a $class"); -} - -for my $inf (qw/ inf inF iNf iNF Inf InF INf INF - infinity Infinity InFiNiTy iNfInItY - /) -{ - my $x = 1 + $inf; - is($x->bstr(), "inf", qq|\$x = 1 + "$inf"|); - is(ref($x), $class, "\$x is a $class"); -}
View file
_service:tar_scm:bignum-0.63.tar.gz/CHANGES -> _service:tar_scm:bignum-0.66.tar.gz/CHANGES
Changed
@@ -1,3 +1,34 @@ +0.66 2022-05-16 + + * Fix documentation errors. + + * Add more tests. + + * Remove redunant code. + +0.65 2022-04-12 + + * Restore the upgrading and downgrading in "bignum", with the exception of + upgrading from Math::BigFloat to Math::BigRat, which I couldn't make sense + of. Now, both integer literals and integers (and Infs and NaNs) that are the + result of a computation become Math::BigInt objects, and both non-integer + literals and non-integers that are as a result of a computation become + Math::BigFloat objects. The classes used for literal integers and non- + integers during compile-time are configurable, as well as the classes used + for downgrading and upgrading during runtime. + + * Add the "bigfloat" pragma, which converts all numeric literals to + Math::BigFloat objects. This is consistent with the "bigint" pragma, which + converts all numeric literals to Math::BigInt objects, and the "bigrat" + pragma which converts all numeric literals to Math::BigRat objects. + +0.64 2021-12-28 + + * Fix CPAN RT #140470. The pragmas ignored user-specified backend libraries. + Add tests to verify the fix. + + * Add missing documentation. + 0.63 2021-10-08 * This version instroduces no changes to the Perl modules, only the tests.
View file
_service:tar_scm:bignum-0.63.tar.gz/MANIFEST -> _service:tar_scm:bignum-0.66.tar.gz/MANIFEST
Changed
@@ -1,7 +1,9 @@ BUGS CHANGES +gentest/backend.sh gentest/scope-nested-const.sh gentest/scope-nested-hex-oct.sh +lib/bigfloat.pm lib/bigint.pm lib/bignum.pm lib/bigrat.pm @@ -16,28 +18,52 @@ README.md t/00sig.t t/01load.t +t/backend-gmp-bigfloat.t +t/backend-gmp-bigint.t +t/backend-gmp-bignum.t +t/backend-gmp-bigrat.t +t/backend-pari-bigfloat.t +t/backend-pari-bigint.t +t/backend-pari-bignum.t +t/backend-pari-bigrat.t t/bigexp.t +t/bigfloat.t t/bigint.t t/bignum.t t/bigrat.t +t/const-bigfloat.t t/const-bigint.t t/const-bignum.t t/const-bigrat.t +t/down-mbi-up-mbf.t +t/down-mbi-up-mbr.t +t/down-mbi-up-undef.t +t/down-undef-up-mbf.t +t/e_pi-bigfloat.t t/e_pi-bigint.t t/e_pi-bignum.t t/e_pi-bigrat.t +t/import-bigfloat.t t/import-bigint.t t/import-bignum.t t/import-bigrat.t t/in_effect.t +t/infnan-bigfloat.t t/infnan-bigint.t -t/infnan-bignum.t +t/infnan-bignum-mbf.t +t/infnan-bignum-mbr.t t/infnan-bigrat.t +t/option_a-bignum.t t/option_a.t -t/option_l.t +t/option_l-bigfloat.t +t/option_l-bigint.t +t/option_l-bignum.t +t/option_l-bigrat.t +t/option_p-bignum.t t/option_p.t t/overrides.t t/ratopt_a.t +t/scope-bigfloat.t t/scope-bigint.t t/scope-bignum.t t/scope-bigrat.t
View file
_service:tar_scm:bignum-0.63.tar.gz/META.json -> _service:tar_scm:bignum-0.66.tar.gz/META.json
Changed
@@ -4,7 +4,7 @@ "Peter John Acklam <pjacklam@gmail.com>" , "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010", "license" : "perl_5" , @@ -30,8 +30,9 @@ }, "runtime" : { "requires" : { - "Math::BigInt" : "1.999825", - "Math::BigRat" : "0.2618", + "Carp" : "1.22", + "Math::BigInt" : "1.99983", + "Math::BigRat" : "0.2623", "perl" : "5.006" } }, @@ -49,6 +50,6 @@ "web" : "https://github.com/pjacklam/p5-bignum" } }, - "version" : "0.63", - "x_serialization_backend" : "JSON::PP version 4.06" + "version" : "0.66", + "x_serialization_backend" : "JSON::PP version 4.08" }
View file
_service:tar_scm:bignum-0.63.tar.gz/META.yml -> _service:tar_scm:bignum-0.66.tar.gz/META.yml
Changed
@@ -7,7 +7,7 @@ configure_requires: ExtUtils::MakeMaker: '6.58' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.62, 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 @@ -18,10 +18,11 @@ - t - inc requires: - Math::BigInt: '1.999825' - Math::BigRat: '0.2618' + Carp: '1.22' + Math::BigInt: '1.99983' + Math::BigRat: '0.2623' perl: '5.006' resources: repository: https://github.com/pjacklam/p5-bignum.git -version: '0.63' +version: '0.66' x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
View file
_service:tar_scm:bignum-0.63.tar.gz/Makefile.PL -> _service:tar_scm:bignum-0.66.tar.gz/Makefile.PL
Changed
@@ -26,9 +26,10 @@ # A hash of modules that are needed to run the module. 'PREREQ_PM' => { - 'Math::BigInt' => 1.999825, - 'Math::BigRat' => 0.2618, + 'Math::BigInt' => 1.999830, + 'Math::BigRat' => 0.2623, #'Math::BigInt::Lite' => 0.03, # optional + 'Carp' => 1.22, }, # A hash of modules that are needed to test the module but not run or build
View file
_service:tar_scm:bignum-0.63.tar.gz/README.md -> _service:tar_scm:bignum-0.66.tar.gz/README.md
Changed
@@ -18,6 +18,7 @@ perldoc command. perldoc bigint + perldoc bigfloat perldoc bigrat perldoc bignum
View file
_service:tar_scm:bignum-0.63.tar.gz/SIGNATURE -> _service:tar_scm:bignum-0.66.tar.gz/SIGNATURE
Changed
@@ -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,53 +15,79 @@ Hash: RIPEMD160 SHA256 4f012053cd8a6f788d6cbafd78fbe0032eefd98b19ef000ebb2693470936591a BUGS -SHA256 34c345633ec2551faa0cf694a880fab346c5c3c31debc4af489602ab71237e61 CHANGES +SHA256 cb32826f6101b53c05e231aac1d59893bfe33c7c118855b7ad7f441b93210646 CHANGES SHA256 b857edab549ac6893e2df5e1ec768ee46b62bcf1607a55e876f4d23f079eacce LICENSE -SHA256 fe5e230b9dde5749b30ac16da0515083e6438821aa9adfaffa1fb7f31a6fdb04 MANIFEST +SHA256 6e584f624f2a6433ae1eb8f2a66a79574d04e9e126b655f50c2bc1ee2139930f MANIFEST SHA256 189eb86214d84a4eb995bc154cc624d272166b0dc9e8ab936f7d9d5ac2e4a35b MANIFEST.SKIP -SHA256 07dd7dff8c511c27959e848f21a94315d06e2a3b056c26b6abcec3cbda7c7dc9 META.json -SHA256 1c0620bdaa122cc480bbdb4fba5f7a5f77265771d71fd16d5898a8b5ce4651ca META.yml -SHA256 800d79d60072237a474e9fa353b472bc83f61e6dc6613cef1bb052145981b943 Makefile.PL +SHA256 a6de3bdfd80aa365c1812f4a1538f4bbf360d8ed7b88ff52819ac29f8ed0fb44 META.json +SHA256 7c9c35bcb619ed662d3c8a6dcaec7054dcd1aa23b2b6216e697f36202c4b4409 META.yml +SHA256 5103bfbb5f46ccfd44912ccbfc06d9fa608a6bbdb1b85682ac231cfe30a453dc Makefile.PL SHA256 d4c50fab1a5d9d1550e9450ac9522c40722b2cd3cf4b746ea81b5c711fa9be6e README -SHA256 7631f0c99638e7bf3e275056475e3c8cb1138e785cb6b9fd07bf5af411df5fdb README.md +SHA256 bf6bb1afa79a3f5388bc63a13caca4b3386bca2064276ab76a0dfb101421b033 README.md SHA256 c3a2fd0b3664ce9d4c38c2abfc413ac483bb21bf975fd8d92b9799bd73103e91 TODO -SHA256 b6b3e72cfbe21125616460b61830f08a7aff3652d4a1ff49258d1a1d1de7b1af gentest/scope-nested-const.sh -SHA256 72f97d74934df46771f6e2c356c837648b833b56dd6f00609ed4b5ac9b5fda5c gentest/scope-nested-hex-oct.sh -SHA256 d9436ec0b707b1b79b9bc8a5ea5e90cd5cf830dffbcfcd56e39e55f2719d3de9 lib/Math/BigFloat/Trace.pm -SHA256 560de72fee403e77790dfc73dc79aa213a3b5897ae282f54fe448f39ec3596ed lib/Math/BigInt/Trace.pm -SHA256 911a51d86c899065f8689750e4f28fb78fca463b6edce0604b7ce85f53aa1665 lib/Math/BigRat/Trace.pm -SHA256 118ff6b66802b510a95cc560fbb20e4b740e456f54ed1d09f6b439ce64f54075 lib/bigint.pm -SHA256 60ae7d4040f14c3feef3478366632ad86a68c9be348fc9d6776735e3589f7770 lib/bignum.pm -SHA256 8cbd47eefe4d4dbd38268fea69f45f0c1feae86cd21afc11fda30c7c5e9d3c55 lib/bigrat.pm +SHA256 76d223c68cd00ec0b65719275728d08b4685c6950a7788615bdb1cc45d1bc536 gentest/backend.sh +SHA256 2bde21babcede165360f70b2acbfc3bc410a5e773b062eb92aaf0e0ee575146e gentest/scope-nested-const.sh +SHA256 320c02c0e6e83e9b1c88548c4ac4c07212dd242a69d15b0de6ff04693261bf9d gentest/scope-nested-hex-oct.sh +SHA256 ce8ab0f67939250bcc59635c67223f56c6488f670343ba0b1d53e5c13e6b6bea lib/Math/BigFloat/Trace.pm +SHA256 a7af01f51d19ace6d6490983e81c70ea74803a62c1cf5cfa78b95e8a9d1a8c23 lib/Math/BigInt/Trace.pm +SHA256 6ee313f78accec8455d784574348e587b4c4a03d4ff33e1aaf35e069aff45376 lib/Math/BigRat/Trace.pm +SHA256 a3f627ebb60219c7349e95f0e1217638f7518a2a6f0f0d58312b46712ecb143a lib/bigfloat.pm +SHA256 9bfd11a33795871d33c7d0ef17d743ed68d4d96874d1ac4b37f6345a82067592 lib/bigint.pm +SHA256 82a3fa04e031a600839daed52a2d96decdff5c3301c7ac45da71684eb819e847 lib/bignum.pm +SHA256 11340d64f756fc3238984c35eb77e8b315f280ae38c52e7f811154c35029cc82 lib/bigrat.pm SHA256 059e77d9167b868dff71708a3b4c136be1d3d49c3604157635c3b738d9291eb7 t/00sig.t -SHA256 5e0cf76a8689752c7983b6aedf3c557d16e0f3b4c1902d905682c941d5549121 t/01load.t -SHA256 63189bfc0cc0c70a9a23fc94cce4782d692601c17279f9250579c1f3800489b5 t/bigexp.t -SHA256 eaa385663679d89447d737906e586e181da88e0a0cdfdbb424d4eee29222b01e t/bigint.t -SHA256 cf4ddd1bf92130e33238b892e989c9a24737ac4512abe18be4b181f9e6bacb56 t/bignum.t -SHA256 6176f09de398675753b37490b76946864b4b1fcb7afc024bb541ed61ce21c8eb t/bigrat.t +SHA256 58d4937cd8dd1252925fb809c055ae83159614ff5eb2282bd1eb3f4dd8b99a4f t/01load.t +SHA256 a2a00317ddeb40505e1086bbf72dbe279efc783fb3cc21605ea4425b4743990b t/backend-gmp-bigfloat.t +SHA256 ecf911b53685d5e30fa448ce5de966cc60838fc83bcc57b3a97d75b6ea0dc15c t/backend-gmp-bigint.t +SHA256 cfbf4571590a1282000c4f0a3e633300357c0f6c7466b0e59b7e4a694f873a1f t/backend-gmp-bignum.t +SHA256 9f7571e7110009cf1847f34af3a10117b5cee5f15da6251ccc672f2c6e073e27 t/backend-gmp-bigrat.t +SHA256 252f21d6d491c81fc0d8df1e072a0dd35c1365b4f7e169d4751a11998370b0d9 t/backend-pari-bigfloat.t +SHA256 1106289d80f2dca781d27c82688bd891bab3bdad6891e0f651147c7ffc302a72 t/backend-pari-bigint.t +SHA256 bd7a8c2ed5a26a049aee710586034b08266d02c18bda5004d8b00481f4ad8ee7 t/backend-pari-bignum.t +SHA256 f007b9f87c5a7e21f3bc6e4f8da2fd28ac2859e7017dfd82205feaa0767d5c13 t/backend-pari-bigrat.t +SHA256 71d4f3df60d8ec936c0f3e0f0844bcb2e0fb4681fd8b940c10ea5737a76792dc t/bigexp.t +SHA256 6191827f53ef3909536f28ab6cd1029796d1a1667eb9b00856860dcd84cadfcb t/bigfloat.t +SHA256 91b8966747dcd88215c7c42c30d9451ad5bd17669d95e8c4d6f50503e50348a0 t/bigint.t +SHA256 0016e3ca4c127ce6bf3e9f3a08ea459e3cd2f6c7e872ae7910cf46230551af3c t/bignum.t +SHA256 fb89c5eff3ab9ef48cd1bf240a7edbde0ba76af8c8aac4d4a1de8dd43b38573e t/bigrat.t +SHA256 44d6c80272edf5be90a298c48de75f0ab2ade2b1d910c10b9ff1289b01d3166c t/const-bigfloat.t SHA256 a52de5f9bb76fa07776803351744b698e319373434f0a7cce21be4d665c5de89 t/const-bigint.t -SHA256 45dbc00e4bd00b0fc632600d89cd90ac8f8bd148ee9d8dbb35bb9faf62c0527f t/const-bignum.t +SHA256 cf5e2de9806aa3f7e3374ed460f0641125f0e000317af15d1263fd5e5f1693f0 t/const-bignum.t SHA256 42c205502bddc431dc0bb03465582d851dbc56b9c400cba78d90a76b7cc8063b t/const-bigrat.t +SHA256 d00754aa5f7e6f3b365f76293e3ef20938e0d9dbe2f9a68d89d5452202fbcb4f t/down-mbi-up-mbf.t +SHA256 f953bc969c0f24adcda7d7d0e25e67d6b31c8e9951cad3eb05b5fcd6458100f5 t/down-mbi-up-mbr.t +SHA256 a8b1ca3daab87e6a33a78ec3c683ebb71894715ad5d0e8b5429ec879c17b17d5 t/down-mbi-up-undef.t +SHA256 9cb25f89d19886c89193a19653ad75294b1366eec1a28c3f8ab3975d68938825 t/down-undef-up-mbf.t +SHA256 48cb5171650de738694aba390f4a7162c6955b63b417c4670ea87dba6c53457b t/e_pi-bigfloat.t SHA256 2bb90d07deeae0c9980977061e055a40848899def6e7eae0f166ad6069a49f65 t/e_pi-bigint.t SHA256 7f589e2516755be3f2f1aff4d62ade739d826df41f3ff034d2d4ead07ae53b96 t/e_pi-bignum.t SHA256 1c0f1c3dfa53423081df182a6fa3106086d3be882a9bbde4b05a4195b7433122 t/e_pi-bigrat.t +SHA256 fa6c29e1563bc8d5de16bc7d21887d09498156407c85b7bacb6760019f12934b t/import-bigfloat.t SHA256 6e3f322b9cafa2d598993a81e4448e2423c7900cecb8cf57653c8497b552bf10 t/import-bigint.t SHA256 02067e08078237787dd1b04d62178dc1f9b37e1dcd0258bf5a3506e66f929dba t/import-bignum.t SHA256 ebe1a1d142ce6e67ec709ebdd66d0cfe4f7b625436b55cb3681395fe3978c4d7 t/import-bigrat.t -SHA256 892a7323649ee8bd5407bdbfb21e231eb98b55eadc71cd9b86aa1bf8d2c8730f t/in_effect.t +SHA256 916dad6b8ef98e8593756a37c0d20f3058665f8b8fb03cd7e6225a3cf16e6f01 t/in_effect.t +SHA256 809054ba9ac8aa352c61d56a915c7cd11b0e96c89ac71165c1ae649bc45a9449 t/infnan-bigfloat.t SHA256 8ce5a07d5ea983357ec087e672dd7461bba13872d0085038998034e7b18e493a t/infnan-bigint.t -SHA256 29467a04a86f49ef0a88ae111b2447e11366efb2662622c87290fd98133153d2 t/infnan-bignum.t +SHA256 6613f6695af2e92209bf0425250f97b515f5a5c7e4bd275891c0af29061a07fc t/infnan-bignum-mbf.t +SHA256 0ddceed1441d32d7e01781c8e7b71e3dbe4f98326c16f7d0cbe6c829b38a14ca t/infnan-bignum-mbr.t SHA256 c3bb2b45441ec5f3fcb7fa908b6523a2ea9a7c013e5ba500b3a8a2d8cb35088b t/infnan-bigrat.t -SHA256 decf5265bc46beccad2e9a560b200512f418735e049a8b37ef9fa6622f1fe48e t/option_a.t -SHA256 003fc59553ecf886ab681262089340a25da97d6564909b5b28fe7d485fa06dcb t/option_l.t -SHA256 d55e3ff06a3e5070a1c2720fe8e68aa414a1d793fb445fc0b7e5d42ecaf48f2a t/option_p.t -SHA256 a4e6d1c429252020842a31b31dc69a6dc9be383a929c674ba08b24f676e4b6a5 t/overrides.t +SHA256 568899b1b5c59a316838eb9779f19dd4eae4b48db600ea69d0de0f1a67b50476 t/option_a-bignum.t +SHA256 7d55a3c3a1154618eee3212074f5b0bb857be9b096585cb6d44d2601276e9373 t/option_a.t +SHA256 8a5d876498b9507387782cd5a6e2cda9af746dd8b7790e5ff34f66bafe4fa09f t/option_l-bigfloat.t +SHA256 f4c0d984b4b054a5594b684563ef1f0aa700c0273f9b09850d37947be1dc86d1 t/option_l-bigint.t +SHA256 003fc59553ecf886ab681262089340a25da97d6564909b5b28fe7d485fa06dcb t/option_l-bignum.t +SHA256 8079af11d6d3ed54a8ce9ca228ab49dc62bc8aa7fa936fc342afe24e1fb82b38 t/option_l-bigrat.t +SHA256 27599762f027be2dd46d1d5392e1dd9e365729a0eae99386127ef743cfa0e7fe t/option_p-bignum.t +SHA256 b76104e2c3e6fb91fa4d567e642afe7fa94be3ac42c158d6a3cef3c801a8f312 t/option_p.t +SHA256 d5ce85be338153a1d4368224230d7620ab2aa15217a899f9a70831c2d5bff081 t/overrides.t SHA256 20059239722f6b123abdc5e6d8acb91198acd5d7bbae0a127fda491fe2d0f40b t/ratopt_a.t +SHA256 155b0036b410ef41952c929917e5e8c695a3caa2e40f0b2b9602f8d813f2d624 t/scope-bigfloat.t SHA256 f8b37da2a628b8e8a18820693285cd2fe8d408a33cb949e386cb617d9bf0f3b1 t/scope-bigint.t -SHA256 990305ff86dd250c534598467136e0e1524f470ce9e9b8da18ca3ba3006cb37b t/scope-bignum.t +SHA256 0b2b4b4b094789fcd6c7fffb117ef133c311f3e5677a107445eea808f826dc60 t/scope-bignum.t SHA256 e465b8cef2431511bcc023ac2f5be6ffaa49d2a3b0ecfed3df6cfe89f2c0664d t/scope-bigrat.t -SHA256 2d3f498d48219aea8265ebc123c0d699b3229b13471c3a7c776dce32938fd8c1 t/scope-nested-const.t -SHA256 414fa046692af4830779352aebd5107fd293fd0d13aeda14312ba84a8f63fca8 t/scope-nested-hex-oct.t +SHA256 b17e8fb66e4408bfebdda41d94c96f1b8de4eb08ae06587d703b817a9ab10689 t/scope-nested-const.t +SHA256 b17e8fb66e4408bfebdda41d94c96f1b8de4eb08ae06587d703b817a9ab10689 t/scope-nested-hex-oct.t SHA256 e07242be8e773be3d5f2749249dd4249cec767877fdaa5f288cdae8166c7478e xt/author/bigint-hex.t SHA256 69341a183b10ba3ca39c21580c3a774474731685d15781ed5e756613f1a5bf0a xt/author/bigint-oct.t SHA256 19aa568f7ff2bbc701603db89123fcdafac4fb78ddb2c4a73804787674544d64 xt/author/critic.t @@ -81,11 +107,11 @@ SHA256 79e228dfe3193c0f2b5f9afaa6677062ef33ac9c9578e0e6c5a627696c319982 xt/release/version.t -----BEGIN PGP SIGNATURE----- -iQEcBAEBAwAGBQJhYd6PAAoJEGcmPl2fr166nvEH/3I6njJfpFyMn3qgqm5JcenK -STdglC72HwNOFYMtLpTrtwsf44ptWH/6d/o0UD8y7znRG21IYElIt/pWslPbYY4f -aks31Pugvo2Qk1ndIzok4WzerXs31AciP8dFaADxXFeBh0p0k1grt6TFeYZ/t+6W -0PDq2vo4J9lb+8x5KBuKNXCfEC2x7xvnM+ty+bePcgd+DnepGsE9JXyIRhAmfIEp -2cemFDqRnjYXGx7++Ipl2cqCZSJmuLye9v9nlze1LbgcltBGrPnz1c/Y/BYGbx6+ -e0HxqJ/wgwMkC3iDsBTqPGjE7ktDcB+c2xcutTwK2A1H8b+EpZ/fqz9YGKKOnDk= -=39QB +iQEcBAEBAwAGBQJignu8AAoJEGcmPl2fr166VJwIALBaL7Hq/7ojq5JsRjju1dlb +OZrCE0SB5WfVexazVx1BDxc3CooLRmisbMXbzpMRZrfvxREECKtgS08seRna/dyw +qTLPU5ihD6qRAI4bOeZCRlkAWlnJGcz025MJOl068hAgoB73NLu2xEeHJ+Mo9Ei+ +k23cTB1gtnUEisjCwh0v+Lwk6HSPuPw6DqZVOi2NOv2Rvl62u3W2rYLUMjqPB1bJ +/O9eR6wMdvz4LxFR9/YBAtERvCmP4rJBUKz1nd3mmELkQCuo941W5/ZoUhPdUKlp +2HVlhJVWPVsAmc6j2zqKny8Ob81/4jgnUAzHD2TTHmEKG9U9Vc9ElkCyjZmfFCE= +=PYF9 -----END PGP SIGNATURE-----
View file
_service:tar_scm:bignum-0.66.tar.gz/gentest/backend.sh
Added
@@ -0,0 +1,53 @@ +#!/bin/bash -u + +modules=( + bigint + bigfloat + bigrat + bignum +) + +backends=( + #FastCalc + GMP + Pari + #GMPz + #BitVect + #LTM +) + +dirname=$( dirname -- "$0" ) || exit +cd "$dirname" || exit + +gitroot=$( git rev-parse --show-toplevel ) || exit +cd "$gitroot" || exit + +for backend in ${backends@}; do + for module in ${modules@}; do + file=t/backend-${backend,,}-$module.t + cat <<EOF >$file +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval { require Math::BigInt::$backend; }; + if (\$@) { + plan skip_all => "Math::BigInt::$backend not installed"; + } else { + plan tests => "1"; + } +} + +use $module only => "$backend"; + +my \$x = 1; +is(\$x -> config("lib"), "Math::BigInt::$backend", + "backend is Math::BigInt::$backend"); +EOF + echo "Wrote '$file'" + done +done
View file
_service:tar_scm:bignum-0.63.tar.gz/gentest/scope-nested-const.sh -> _service:tar_scm:bignum-0.66.tar.gz/gentest/scope-nested-const.sh
Changed
@@ -10,21 +10,40 @@ use strict; use warnings; +use File::Basename; + +my $outfile = "t/scope-nested-const.t"; + +my $dirname = dirname(__FILE__); +chdir $dirname + or die "$dirname: chdir failed: $!"; + +chomp(my $gitroot = `git rev-parse --show-toplevel`); +chdir $gitroot + or die "$gitroot: chdir failed: $!"; + +open my($fh), ">", $outfile + or die "$outfile: can't open file for writing: $!"; + use Algorithm::Combinatorics 'permutations'; my $data = - 'bigint', 'Math::BigInt' , - 'bignum', 'Math::BigFloat', - 'bigrat', 'Math::BigRat' , + 'bigint', 'Math::BigInt' , + 'bigfloat', 'Math::BigFloat', + 'bigrat', 'Math::BigRat' , ; -print <<"EOF"; -#!perl +print $fh <<'EOF' or die "$outfile: print failed: $!"; +# -*- mode: perl; -*- use strict; use warnings; -use Test::More tests => 48; +use Test::More; + +plan skip_all => 'Need at least Perl v5.10.1' if $ < "5.010001"; + +plan tests => 96; EOF my $iter = permutations(0, 1, 2); @@ -37,42 +56,55 @@ my $p2 = $data -> $idxs -> 2 0; my $c2 = $data -> $idxs -> 2 1; - print <<"EOF"; + print $fh <<"EOF" or die "$outfile: print failed: $!"; note "\\n$p0 -> $p1 -> $p2\\n\\n"; { note "use $p0;"; use $p0; - is(ref(1), "$c0"); + is(ref(hex("1")), "$c0", 'ref(hex("1"))'); + is(ref(oct("1")), "$c0", 'ref(oct("1"))'); { note "use $p1;"; use $p1; - is(ref(1), "$c1"); + is(ref(hex("1")), "$c1", 'ref(hex("1"))'); + is(ref(oct("1")), "$c1", 'ref(oct("1"))'); { note "use $p2;"; use $p2; - is(ref(1), "$c2"); + is(ref(hex("1")), "$c2", 'ref(hex("1"))'); + is(ref(oct("1")), "$c2", 'ref(oct("1"))'); note "no $p2;"; no $p2; - is(ref(1), ""); + is(ref(hex("1")), "", 'ref(hex("1"))'); + is(ref(oct("1")), "", 'ref(oct("1"))'); } - is(ref(1), "$c1"); + is(ref(hex("1")), "$c1", 'ref(hex("1"))'); + is(ref(oct("1")), "$c1", 'ref(oct("1"))'); note "no $p1;"; no $p1; - is(ref(1), ""); + is(ref(hex("1")), "", 'ref(hex("1"))'); + is(ref(oct("1")), "", 'ref(oct("1"))'); } - is(ref(1), "$c0"); + is(ref(hex("1")), "$c0", 'ref(hex("1"))'); + is(ref(oct("1")), "$c0", 'ref(oct("1"))'); note "no $p0;"; no $p0; - is(ref(1), ""); + is(ref(hex("1")), "", 'ref(hex("1"))'); + is(ref(oct("1")), "", 'ref(oct("1"))'); } EOF } + +close($fh) + or die "$outfile: can't close file after writing: $!"; + +print "Wrote '$outfile'\n";
View file
_service:tar_scm:bignum-0.63.tar.gz/gentest/scope-nested-hex-oct.sh -> _service:tar_scm:bignum-0.66.tar.gz/gentest/scope-nested-hex-oct.sh
Changed
@@ -10,21 +10,40 @@ use strict; use warnings; +use File::Basename; + +my $outfile = "t/scope-nested-hex-oct.t"; + +my $dirname = dirname(__FILE__); +chdir $dirname + or die "$dirname: chdir failed: $!"; + +chomp(my $gitroot = `git rev-parse --show-toplevel`); +chdir $gitroot + or die "$gitroot: chdir failed: $!"; + +open my($fh), ">", $outfile + or die "$outfile: can't open file for writing: $!"; + use Algorithm::Combinatorics 'permutations'; my $data = - 'bigint', 'Math::BigInt' , - 'bignum', 'Math::BigFloat', - 'bigrat', 'Math::BigRat' , + 'bigint', 'Math::BigInt' , + 'bigfloat', 'Math::BigFloat', + 'bigrat', 'Math::BigRat' , ; -print <<"EOF"; -#!perl +print $fh <<'EOF' or die "$outfile: print failed: $!"; +# -*- mode: perl; -*- use strict; use warnings; -use Test::More tests => 96; +use Test::More; + +plan skip_all => 'Need at least Perl v5.10.1' if $ < "5.010001"; + +plan tests => 96; EOF my $iter = permutations(0, 1, 2); @@ -37,7 +56,7 @@ my $p2 = $data -> $idxs -> 2 0; my $c2 = $data -> $idxs -> 2 1; - print <<"EOF"; + print $fh <<"EOF" or die "$outfile: print failed: $!"; note "\\n$p0 -> $p1 -> $p2\\n\\n"; @@ -84,3 +103,8 @@ } EOF } + +close($fh) + or die "$outfile: can't close file after writing: $!"; + +print "Wrote '$outfile'\n";
View file
_service:tar_scm:bignum-0.63.tar.gz/lib/Math/BigFloat/Trace.pm -> _service:tar_scm:bignum-0.66.tar.gz/lib/Math/BigFloat/Trace.pm
Changed
@@ -10,7 +10,7 @@ our @ISA = qw(Exporter Math::BigFloat); -our $VERSION = '0.63'; +our $VERSION = '0.66'; use overload; # inherit overload from Math::BigFloat
View file
_service:tar_scm:bignum-0.63.tar.gz/lib/Math/BigInt/Trace.pm -> _service:tar_scm:bignum-0.66.tar.gz/lib/Math/BigInt/Trace.pm
Changed
@@ -10,7 +10,7 @@ our @ISA = qw(Exporter Math::BigInt); -our $VERSION = '0.63'; +our $VERSION = '0.66'; use overload; # inherit overload from Math::BigInt
View file
_service:tar_scm:bignum-0.63.tar.gz/lib/Math/BigRat/Trace.pm -> _service:tar_scm:bignum-0.66.tar.gz/lib/Math/BigRat/Trace.pm
Changed
@@ -10,7 +10,7 @@ our @ISA = qw(Exporter Math::BigRat); -our $VERSION = '0.63'; +our $VERSION = '0.66'; use overload; # inherit overload from Math::BigRat
View file
_service:tar_scm:bignum-0.66.tar.gz/lib/bigfloat.pm
Added
@@ -0,0 +1,851 @@ +package bigfloat; + +use strict; +use warnings; + +use Carp qw< carp croak >; + +our $VERSION = '0.66'; + +use Exporter; +our @ISA = qw( Exporter ); +our @EXPORT_OK = qw( PI e bpi bexp hex oct ); +our @EXPORT = qw( inf NaN ); + +use overload; + +my $obj_class = "Math::BigFloat"; + +############################################################################## + +sub accuracy { + my $self = shift; + $obj_class -> accuracy(@_); +} + +sub precision { + my $self = shift; + $obj_class -> precision(@_); +} + +sub round_mode { + my $self = shift; + $obj_class -> round_mode(@_); +} + +sub div_scale { + my $self = shift; + $obj_class -> div_scale(@_); +} + +sub upgrade { + my $self = shift; + $obj_class -> upgrade(@_); +} + +sub downgrade { + my $self = shift; + $obj_class -> downgrade(@_); +} + +sub in_effect { + my $level = shift || 0; + my $hinthash = (caller($level))10; + $hinthash->{bigfloat}; +} + +sub _float_constant { + my $str = shift; + + # See if we can convert the input string to a string using a normalized form + # consisting of the significand as a signed integer, the character "e", and + # the exponent as a signed integer, e.g., "+0e+0", "+314e-2", and "-1e+3". + + my $nstr; + + if ( + # See if it is an octal number. An octal number like '0377' is also + # accepted by the functions parsing decimal and hexadecimal numbers, so + # handle octal numbers before decimal and hexadecimal numbers. + + $str =~ /^0(?:Oo|_*0-7)/ and + $nstr = Math::BigInt -> oct_str_to_dec_flt_str($str) + + or + + # See if it is decimal number. + + $nstr = Math::BigInt -> dec_str_to_dec_flt_str($str) + + or + + # See if it is a hexadecimal number. Every hexadecimal number has a + # prefix, but the functions parsing numbers don't require it, so check + # to see if it actually is a hexadecimal number. + + $str =~ /^0Xx/ and + $nstr = Math::BigInt -> hex_str_to_dec_flt_str($str) + + or + + # See if it is a binary numbers. Every binary number has a prefix, but + # the functions parsing numbers don't require it, so check to see if it + # actually is a binary number. + + $str =~ /^0Bb/ and + $nstr = Math::BigInt -> bin_str_to_dec_flt_str($str)) + { + return $obj_class -> new($nstr); + } + + # If we get here, there is a bug in the code above this point. + + warn "Internal error: unable to handle literal constant '$str'.", + " This is a bug, so please report this to the module author."; + return $obj_class -> bnan(); +} + +############################################################################# +# the following two routines are for "use bigfloat qw/hex oct/;": + +use constant LEXICAL => $ > 5.009004; + +# Internal function with the same semantics as CORE::hex(). This function is +# not used directly, but rather by other front-end functions. + +sub _hex_core { + my $str = shift; + + # Strip off, clean, and parse as much as we can from the beginning. + + my $x; + if ($str =~ s/ ^ ( 0? xX )? ( 0-9a-fA-F* ( _ 0-9a-fA-F+ )* ) //x) { + my $chrs = $2; + $chrs =~ tr/_//d; + $chrs = '0' unless CORE::length $chrs; + $x = $obj_class -> from_hex($chrs); + } else { + $x = $obj_class -> bzero(); + } + + # Warn about trailing garbage. + + if (CORE::length($str)) { + require Carp; + Carp::carp(sprintf("Illegal hexadecimal digit '%s' ignored", + substr($str, 0, 1))); + } + + return $x; +} + +# Internal function with the same semantics as CORE::oct(). This function is +# not used directly, but rather by other front-end functions. + +sub _oct_core { + my $str = shift; + + $str =~ s/^\s*//; + + # Hexadecimal input. + + return _hex_core($str) if $str =~ /^0?xX/; + + my $x; + + # Binary input. + + if ($str =~ /^0?bB/) { + + # Strip off, clean, and parse as much as we can from the beginning. + + if ($str =~ s/ ^ ( 0? bB )? ( 01* ( _ 01+ )* ) //x) { + my $chrs = $2; + $chrs =~ tr/_//d; + $chrs = '0' unless CORE::length $chrs; + $x = $obj_class -> from_bin($chrs); + } + + # Warn about trailing garbage. + + if (CORE::length($str)) { + require Carp; + Carp::carp(sprintf("Illegal binary digit '%s' ignored", + substr($str, 0, 1))); + } + + return $x; + } + + # Octal input. Strip off, clean, and parse as much as we can from the + # beginning. + + if ($str =~ s/ ^ ( 0? oO )? ( 0-7* ( _ 0-7+ )* ) //x) { + my $chrs = $2; + $chrs =~ tr/_//d; + $chrs = '0' unless CORE::length $chrs; + $x = $obj_class -> from_oct($chrs); + } + + # Warn about trailing garbage. CORE::oct() only warns about 8 and 9, but it + # is more helpful to warn about all invalid digits. + + if (CORE::length($str)) { + require Carp; + Carp::carp(sprintf("Illegal octal digit '%s' ignored", + substr($str, 0, 1))); + } + + return $x;
View file
_service:tar_scm:bignum-0.63.tar.gz/lib/bigint.pm -> _service:tar_scm:bignum-0.66.tar.gz/lib/bigint.pm
Changed
@@ -5,7 +5,7 @@ use Carp qw< carp croak >; -our $VERSION = '0.63'; +our $VERSION = '0.66'; use Exporter; our @ISA = qw( Exporter ); @@ -13,7 +13,6 @@ our @EXPORT = qw( inf NaN ); use overload; -use Math::BigInt; my $obj_class = "Math::BigInt"; @@ -39,16 +38,6 @@ $obj_class -> div_scale(@_); } -sub upgrade { - my $self = shift; - $obj_class -> upgrade(@_); -} - -sub downgrade { - my $self = shift; - $obj_class -> downgrade(@_); -} - sub in_effect { my $level = shift || 0; my $hinthash = (caller($level))10; @@ -108,9 +97,6 @@ my $expo = substr($nstr, $pos + 2); if ($expo_sgn eq '-') { - my $upgrade = $obj_class -> upgrade(); - return $upgrade -> new($nstr) if defined $upgrade; - if ($mant_len <= $expo) { return $obj_class -> bzero(); # underflow } else { @@ -249,19 +235,19 @@ if (LEXICAL) { eval <<'.' } sub _hex(_) { my $hh = (caller 0)10; - return $$hh{bigint} ? bigint::_hex_core($_0) - : $$hh{bignum} ? bignum::_hex_core($_0) - : $$hh{bigrat} ? bigrat::_hex_core($_0) - : $prev_hex ? &$prev_hex($_0) + return $$hh{bigint} ? bigint::_hex_core($_0) + : $$hh{bigfloat} ? bigfloat::_hex_core($_0) + : $$hh{bigrat} ? bigrat::_hex_core($_0) + : $prev_hex ? &$prev_hex($_0) : CORE::hex($_0); } sub _oct(_) { my $hh = (caller 0)10; - return $$hh{bigint} ? bigint::_oct_core($_0) - : $$hh{bignum} ? bignum::_oct_core($_0) - : $$hh{bigrat} ? bigrat::_oct_core($_0) - : $prev_oct ? &$prev_oct($_0) + return $$hh{bigint} ? bigint::_oct_core($_0) + : $$hh{bigfloat} ? bigfloat::_oct_core($_0) + : $$hh{bigrat} ? bigrat::_oct_core($_0) + : $prev_oct ? &$prev_oct($_0) : CORE::oct($_0); } . @@ -284,9 +270,9 @@ sub import { my $class = shift; - $^H{bigint} = 1; # we are in effect - $^H{bignum} = undef; - $^H{bigrat} = undef; + $^H{bigint} = 1; # we are in effect + $^H{bigfloat} = undef; + $^H{bigrat} = undef; # for newer Perls always override hex() and oct() with a lexical version: if (LEXICAL) { @@ -300,38 +286,24 @@ while (@_) { my $param = shift; - # Upgrading. - - if ($param eq 'upgrade') { - $class -> upgrade(shift); - next; - } - - # Downgrading. - - if ($param eq 'downgrade') { - $class -> downgrade(shift); - next; - } - # Accuracy. if ($param =~ /^a(ccuracy)?$/) { - $class -> accuracy(shift); + push @import, 'accuracy', shift(); next; } # Precision. if ($param =~ /^p(recision)?$/) { - $class -> precision(shift); + push @import, 'precision', shift(); next; } # Rounding mode. if ($param eq 'round_mode') { - $class -> round_mode(shift); + push @import, 'round_mode', shift(); next; } @@ -363,6 +335,8 @@ croak("Unknown option '$param'"); } + eval "require $obj_class"; + die $@ if $@; $obj_class -> import(@import); if ($ver) { @@ -579,8 +553,8 @@ Override the built-in hex() method with a version that can handle big numbers. This overrides it by exporting it to the current package. Under Perl v5.10.0 and -higher, this is not so necessary, as hex() is lexically overridden in the -current scope whenever the C<bigint> pragma is active. +higher, this is not necessary, as hex() is lexically overridden in the current +scope whenever the C<bigint> pragma is active. =item oct @@ -713,10 +687,21 @@ # perl -Mbigint=bpi -wle 'print bpi(80)' -=item upgrade() +=item accuracy() + +Set or get the accuracy. + +=item precision() + +Set or get the precision. + +=item round_mode() + +Set or get the rounding mode. + +=item div_scale() -Return the class that numbers are upgraded to, is in fact returning -C<Math::BigInt-E<gt>upgrade()>. +Set or get the division scale. =item in_effect() @@ -812,11 +797,11 @@ =head1 EXAMPLES Some cool command line examples to impress the Python crowd ;) You might want -to compare them to the results under -Mbignum or -Mbigrat: +to compare them to the results under -Mbigfloat or -Mbigrat: perl -Mbigint -le 'print sqrt(33)' - perl -Mbigint -le 'print 2*255' - perl -Mbigint -le 'print 4.5+2*255' + perl -Mbigint -le 'print 2**255' + perl -Mbigint -le 'print 4.5+2**255' perl -Mbigint -le 'print 123->is_odd()' perl -Mbigint=l,GMP -le 'print 7 ** 7777'
View file
_service:tar_scm:bignum-0.63.tar.gz/lib/bignum.pm -> _service:tar_scm:bignum-0.66.tar.gz/lib/bignum.pm
Changed
@@ -5,7 +5,7 @@ use Carp qw< carp croak >; -our $VERSION = '0.63'; +our $VERSION = '0.66'; use Exporter; our @ISA = qw( Exporter ); @@ -13,40 +13,48 @@ our @EXPORT = qw( inf NaN ); use overload; -use Math::BigFloat; -my $obj_class = "Math::BigFloat"; +# Defaults: When a constant is an integer, Inf or NaN, it is converted to an +# object of class $int_class. When a constant is a finite non-integer, it is +# converted to an object of class $float_class. + +my $int_class = 'Math::BigInt'; +my $float_class = 'Math::BigFloat'; ############################################################################## sub accuracy { - my $self = shift; - $obj_class -> accuracy(@_); + shift; + $int_class -> accuracy(@_); + $float_class -> accuracy(@_); } sub precision { - my $self = shift; - $obj_class -> precision(@_); + shift; + $int_class -> precision(@_); + $float_class -> precision(@_); } sub round_mode { - my $self = shift; - $obj_class -> round_mode(@_); + shift; + $int_class -> round_mode(@_); + $float_class -> round_mode(@_); } sub div_scale { - my $self = shift; - $obj_class -> div_scale(@_); + shift; + $int_class -> div_scale(@_); + $float_class -> div_scale(@_); } sub upgrade { - my $self = shift; - $obj_class -> upgrade(@_); + shift; + $int_class -> upgrade(@_); } sub downgrade { - my $self = shift; - $obj_class -> downgrade(@_); + shift; + $float_class -> downgrade(@_); } sub in_effect { @@ -96,14 +104,38 @@ $str =~ /^0Bb/ and $nstr = Math::BigInt -> bin_str_to_dec_flt_str($str)) { - return $obj_class -> new($nstr); + my $pos = index($nstr, 'e'); + my $expo_sgn = substr($nstr, $pos + 1, 1); + my $sign = substr($nstr, 0, 1); + my $mant = substr($nstr, 1, $pos - 1); + my $mant_len = CORE::length($mant); + my $expo = substr($nstr, $pos + 2); + + # The number is a non-integer if and only if the exponent is negative. + + if ($expo_sgn eq '-') { + return $float_class -> new($str); + + my $upgrade = $int_class -> upgrade(); + return $upgrade -> new($nstr) if defined $upgrade; + + if ($mant_len <= $expo) { + return $int_class -> bzero(); # underflow + } else { + $mant = substr $mant, 0, $mant_len - $expo; # truncate + return $int_class -> new($sign . $mant); + } + } else { + $mant .= "0" x $expo; # pad with zeros + return $int_class -> new($sign . $mant); + } } # If we get here, there is a bug in the code above this point. warn "Internal error: unable to handle literal constant '$str'.", " This is a bug, so please report this to the module author."; - return $obj_class -> bnan(); + return $int_class -> bnan(); } ############################################################################# @@ -124,9 +156,9 @@ my $chrs = $2; $chrs =~ tr/_//d; $chrs = '0' unless CORE::length $chrs; - $x = $obj_class -> from_hex($chrs); + $x = $int_class -> from_hex($chrs); } else { - $x = $obj_class -> bzero(); + $x = $int_class -> bzero(); } # Warn about trailing garbage. @@ -164,7 +196,7 @@ my $chrs = $2; $chrs =~ tr/_//d; $chrs = '0' unless CORE::length $chrs; - $x = $obj_class -> from_bin($chrs); + $x = $int_class -> from_bin($chrs); } # Warn about trailing garbage. @@ -185,7 +217,7 @@ my $chrs = $2; $chrs =~ tr/_//d; $chrs = '0' unless CORE::length $chrs; - $x = $obj_class -> from_oct($chrs); + $x = $int_class -> from_oct($chrs); } # Warn about trailing garbage. CORE::oct() only warns about 8 and 9, but it @@ -260,7 +292,7 @@ sub import { my $class = shift; - $^H{bignum} = 1; # we are in effect + $^H{bignum} = 1; # we are in effect $^H{bigint} = undef; $^H{bigrat} = undef; @@ -269,9 +301,11 @@ _override(); } - my @import = (); - my @a = (); # unrecognized arguments - my $ver; # version? + my @import = (); # common options + my @int_import = (upgrade => $float_class); # int class only options + my @flt_import = (downgrade => $int_class); # float class only options + my @a = (); # unrecognized arguments + my $ver; # display version info? while (@_) { my $param = shift; @@ -279,35 +313,39 @@ # Upgrading. if ($param eq 'upgrade') { - $class -> upgrade(shift); + my $arg = shift; + $float_class = $arg if defined $arg; + push @int_import, 'upgrade', $arg; next; } # Downgrading. if ($param eq 'downgrade') { - $class -> downgrade(shift); + my $arg = shift; + $int_class = $arg if defined $arg; + push @flt_import, 'downgrade', $arg; next; } # Accuracy. if ($param =~ /^a(ccuracy)?$/) { - $class -> accuracy(shift); + push @import, 'accuracy', shift(); next; } # Precision. if ($param =~ /^p(recision)?$/) { - $class -> precision(shift);
View file
_service:tar_scm:bignum-0.63.tar.gz/lib/bigrat.pm -> _service:tar_scm:bignum-0.66.tar.gz/lib/bigrat.pm
Changed
@@ -5,7 +5,7 @@ use Carp qw< carp croak >; -our $VERSION = '0.63'; +our $VERSION = '0.66'; use Exporter; our @ISA = qw( Exporter ); @@ -13,7 +13,6 @@ our @EXPORT = qw( inf NaN ); use overload; -use Math::BigRat; my $obj_class = "Math::BigRat"; @@ -39,16 +38,6 @@ $obj_class -> div_scale(@_); } -sub upgrade { - my $self = shift; - $obj_class -> upgrade(@_); -} - -sub downgrade { - my $self = shift; - $obj_class -> downgrade(@_); -} - sub in_effect { my $level = shift || 0; my $hinthash = (caller($level))10; @@ -225,19 +214,19 @@ if (LEXICAL) { eval <<'.' } sub _hex(_) { my $hh = (caller 0)10; - return $$hh{bigrat} ? bigrat::_hex_core($_0) - : $$hh{bignum} ? bignum::_hex_core($_0) - : $$hh{bigint} ? bigint::_hex_core($_0) - : $prev_hex ? &$prev_hex($_0) + return $$hh{bigrat} ? bigrat::_hex_core($_0) + : $$hh{bigfloat} ? bigfloat::_hex_core($_0) + : $$hh{bigint} ? bigint::_hex_core($_0) + : $prev_hex ? &$prev_hex($_0) : CORE::hex($_0); } sub _oct(_) { my $hh = (caller 0)10; - return $$hh{bigrat} ? bigrat::_oct_core($_0) - : $$hh{bignum} ? bignum::_oct_core($_0) - : $$hh{bigint} ? bigint::_oct_core($_0) - : $prev_oct ? &$prev_oct($_0) + return $$hh{bigrat} ? bigrat::_oct_core($_0) + : $$hh{bigfloat} ? bigfloat::_oct_core($_0) + : $$hh{bigint} ? bigint::_oct_core($_0) + : $prev_oct ? &$prev_oct($_0) : CORE::oct($_0); } . @@ -260,9 +249,9 @@ sub import { my $class = shift; - $^H{bigrat} = 1; # we are in effect - $^H{bigint} = undef; - $^H{bignum} = undef; + $^H{bigrat} = 1; # we are in effect + $^H{bigint} = undef; + $^H{bigfloat} = undef; # for newer Perls always override hex() and oct() with a lexical version: if (LEXICAL) { @@ -276,38 +265,24 @@ while (@_) { my $param = shift; - # Upgrading. - - if ($param eq 'upgrade') { - $class -> upgrade(shift); - next; - } - - # Downgrading. - - if ($param eq 'downgrade') { - $class -> downgrade(shift); - next; - } - # Accuracy. if ($param =~ /^a(ccuracy)?$/) { - $class -> accuracy(shift); + push @import, 'accuracy', shift(); next; } # Precision. if ($param =~ /^p(recision)?$/) { - $class -> precision(shift); + push @import, 'precision', shift(); next; } # Rounding mode. if ($param eq 'round_mode') { - $class -> round_mode(shift); + push @import, 'round_mode', shift(); next; } @@ -339,6 +314,8 @@ croak("Unknown option '$param'"); } + eval "require $obj_class"; + die $@ if $@; $obj_class -> import(@import); if ($ver) { @@ -395,23 +372,17 @@ sub bpi ($) { my $up = Math::BigFloat -> upgrade(); # get current upgrading, if any ... Math::BigFloat -> upgrade(undef); # ... and disable - my $x = Math::BigFloat -> bpi(@_); - Math::BigFloat -> upgrade($up); # reset the upgrading - return $obj_class -> new($x); } sub bexp ($$) { my $up = Math::BigFloat -> upgrade(); # get current upgrading, if any ... Math::BigFloat -> upgrade(undef); # ... and disable - my $x = Math::BigFloat -> new(shift); $x -> bexp(@_); - Math::BigFloat -> upgrade($up); # reset the upgrading - return $obj_class -> new($x); } @@ -659,10 +630,21 @@ # perl -Mbigrat=bpi -wle 'print bpi(80)' -=item upgrade() +=item accuracy() + +Set or get the accuracy. + +=item precision() + +Set or get the precision. + +=item round_mode() + +Set or get the rounding mode. + +=item div_scale() -Return the class that numbers are upgraded to, is in fact returning -C<Math::BigRat-E<gt>upgrade()>. +Set or get the division scale. =item in_effect()
View file
_service:tar_scm:bignum-0.63.tar.gz/t/01load.t -> _service:tar_scm:bignum-0.66.tar.gz/t/01load.t
Changed
@@ -3,17 +3,18 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 4; BEGIN { - use_ok('bignum'); use_ok('bigint'); + use_ok('bigfloat'); use_ok('bigrat'); + use_ok('bignum'); }; +# Main modules for various distributions. + my @mods = ('bignum', - 'bigint', - 'bigrat', 'Math::BigInt', 'Math::BigRat', 'Math::BigInt::Lite',
View file
_service:tar_scm:bignum-0.66.tar.gz/t/backend-gmp-bigfloat.t
Added
@@ -0,0 +1,21 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval { require Math::BigInt::GMP; }; + if ($@) { + plan skip_all => "Math::BigInt::GMP not installed"; + } else { + plan tests => "1"; + } +} + +use bigfloat only => "GMP"; + +my $x = 1; +is($x -> config("lib"), "Math::BigInt::GMP", + "backend is Math::BigInt::GMP");
View file
_service:tar_scm:bignum-0.66.tar.gz/t/backend-gmp-bigint.t
Added
@@ -0,0 +1,21 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval { require Math::BigInt::GMP; }; + if ($@) { + plan skip_all => "Math::BigInt::GMP not installed"; + } else { + plan tests => "1"; + } +} + +use bigint only => "GMP"; + +my $x = 1; +is($x -> config("lib"), "Math::BigInt::GMP", + "backend is Math::BigInt::GMP");
View file
_service:tar_scm:bignum-0.66.tar.gz/t/backend-gmp-bignum.t
Added
@@ -0,0 +1,21 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval { require Math::BigInt::GMP; }; + if ($@) { + plan skip_all => "Math::BigInt::GMP not installed"; + } else { + plan tests => "1"; + } +} + +use bignum only => "GMP"; + +my $x = 1; +is($x -> config("lib"), "Math::BigInt::GMP", + "backend is Math::BigInt::GMP");
View file
_service:tar_scm:bignum-0.66.tar.gz/t/backend-gmp-bigrat.t
Added
@@ -0,0 +1,21 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval { require Math::BigInt::GMP; }; + if ($@) { + plan skip_all => "Math::BigInt::GMP not installed"; + } else { + plan tests => "1"; + } +} + +use bigrat only => "GMP"; + +my $x = 1; +is($x -> config("lib"), "Math::BigInt::GMP", + "backend is Math::BigInt::GMP");
View file
_service:tar_scm:bignum-0.66.tar.gz/t/backend-pari-bigfloat.t
Added
@@ -0,0 +1,21 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval { require Math::BigInt::Pari; }; + if ($@) { + plan skip_all => "Math::BigInt::Pari not installed"; + } else { + plan tests => "1"; + } +} + +use bigfloat only => "Pari"; + +my $x = 1; +is($x -> config("lib"), "Math::BigInt::Pari", + "backend is Math::BigInt::Pari");
View file
_service:tar_scm:bignum-0.66.tar.gz/t/backend-pari-bigint.t
Added
@@ -0,0 +1,21 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval { require Math::BigInt::Pari; }; + if ($@) { + plan skip_all => "Math::BigInt::Pari not installed"; + } else { + plan tests => "1"; + } +} + +use bigint only => "Pari"; + +my $x = 1; +is($x -> config("lib"), "Math::BigInt::Pari", + "backend is Math::BigInt::Pari");
View file
_service:tar_scm:bignum-0.66.tar.gz/t/backend-pari-bignum.t
Added
@@ -0,0 +1,21 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval { require Math::BigInt::Pari; }; + if ($@) { + plan skip_all => "Math::BigInt::Pari not installed"; + } else { + plan tests => "1"; + } +} + +use bignum only => "Pari"; + +my $x = 1; +is($x -> config("lib"), "Math::BigInt::Pari", + "backend is Math::BigInt::Pari");
View file
_service:tar_scm:bignum-0.66.tar.gz/t/backend-pari-bigrat.t
Added
@@ -0,0 +1,21 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval { require Math::BigInt::Pari; }; + if ($@) { + plan skip_all => "Math::BigInt::Pari not installed"; + } else { + plan tests => "1"; + } +} + +use bigrat only => "Pari"; + +my $x = 1; +is($x -> config("lib"), "Math::BigInt::Pari", + "backend is Math::BigInt::Pari");
View file
_service:tar_scm:bignum-0.63.tar.gz/t/bigexp.t -> _service:tar_scm:bignum-0.66.tar.gz/t/bigexp.t
Changed
@@ -1,14 +1,14 @@ # -*- mode: perl; -*- ############################################################################### -# test for bug #18025: bignum/bigrat can lead to a number that is both 1 and 0 +# test for bug #18025: bigfloat/bigrat can lead to a number that is both 1 and 0 use strict; use warnings; use Test::More tests => 4; -use bignum; +use bigfloat; my $ln_ev = -7 / (10 ** 17); my $ev = exp($ln_ev);
View file
_service:tar_scm:bignum-0.66.tar.gz/t/bigfloat.t
Added
@@ -0,0 +1,59 @@ +# -*- mode: perl; -*- + +############################################################################### + +use strict; +use warnings; + +use Test::More tests => 17; + +use bigfloat; + +############################################################################### +# general tests + +my $x = 5; +is(ref($x), 'Math::BigFloat', '$x = 5 makes $x a Math::BigFloat'); + +$x = 2 + 3.5; +is($x, 5.5, '2 + 3.5 = 5.5'); +is(ref($x), 'Math::BigFloat', '$x = 2 + 3.5 makes $x a Math::BigFloat'); + +$x = 2 ** 255; +is(ref($x), 'Math::BigFloat', '$x = 2 ** 255 makes $x a Math::BigFloat'); + +is(sqrt(12), '3.464101615137754587054892683011744733886', + 'sqrt(12)'); + +is(2/3, "0.6666666666666666666666666666666666666667", '2/3'); + +#is(2 ** 0.5, 'NaN'); # should be sqrt(2); + +is(12->bfac(), 479001600, '12->bfac() = 479001600'); + +# see if Math::BigFloat constant works + +# 0123456789 0123456789 <- default 40 +# 0123456789 0123456789 +is(1/3, '0.3333333333333333333333333333333333333333', '1/3'); + +############################################################################### +# accuracy and precision + +is(bigfloat->accuracy(), undef, 'get accuracy'); +bigfloat->accuracy(12); +is(bigfloat->accuracy(), 12, 'get accuracy again'); +bigfloat->accuracy(undef); +is(bigfloat->accuracy(), undef, 'get accuracy again'); + +is(bigfloat->precision(), undef, 'get precision'); +bigfloat->precision(12); +is(bigfloat->precision(), 12, 'get precision again'); +bigfloat->precision(undef); +is(bigfloat->precision(), undef, 'get precision again'); + +is(bigfloat->round_mode(), 'even', 'get round mode'); +bigfloat->round_mode('odd'); +is(bigfloat->round_mode(), 'odd', 'get round mode again'); +bigfloat->round_mode('even'); +is(bigfloat->round_mode(), 'even', 'get round mode again');
View file
_service:tar_scm:bignum-0.63.tar.gz/t/bigint.t -> _service:tar_scm:bignum-0.66.tar.gz/t/bigint.t
Changed
@@ -5,7 +5,7 @@ use strict; use warnings; -use Test::More tests => 15; +use Test::More tests => 17; use bigint; @@ -15,8 +15,9 @@ my $x = 5; is(ref($x), 'Math::BigInt', '$x = 5 makes $x a Math::BigInt'); -# todo: is(2 + 2.5, 4.5); # should still work -# todo: $x = 2 + 3.5; is(ref($x), 'Math::BigFloat'); +$x = 2 + 3.5; +is($x, 5.5, '2 + 3.5 = 5.5'); +is(ref($x), 'Math::BigInt', '$x = 2 + 3.5 makes $x a Math::BigInt'); $x = 2 ** 255; is(ref($x), 'Math::BigInt', '$x = 2 ** 255 makes $x a Math::BigInt');
View file
_service:tar_scm:bignum-0.63.tar.gz/t/bignum.t -> _service:tar_scm:bignum-0.66.tar.gz/t/bignum.t
Changed
@@ -5,41 +5,27 @@ use strict; use warnings; -use Test::More tests => 19; +use Test::More tests => 15; -use bignum qw/oct hex/; +use bignum; ############################################################################### # general tests my $x = 5; -is(ref($x), 'Math::BigFloat', '$x = 5 makes $x a Math::BigFloat'); # :constant +is(ref($x), 'Math::BigInt', '$x = 5 makes $x a Math::BigInt'); -is(2 + 2.5, 4.5, '2 + 2.5 = 4.5'); $x = 2 + 3.5; +is($x, 5.5, '2 + 3.5 = 5.5'); is(ref($x), 'Math::BigFloat', '$x = 2 + 3.5 makes $x a Math::BigFloat'); -is(2 * 2.1, 4.2, '2 * 2.1 = 4.2'); -$x = 2 + 2.1; -is(ref($x), 'Math::BigFloat', '$x = 2 + 2.1 makes $x a Math::BigFloat'); - $x = 2 ** 255; -is(ref($x), 'Math::BigFloat', '$x = 2 ** 255 makes $x a Math::BigFloat'); - -is(sqrt(12), '3.464101615137754587054892683011744733886', - 'sqrt(12)'); - -is(2/3, "0.6666666666666666666666666666666666666667", '2/3'); - -#is(2 ** 0.5, 'NaN'); # should be sqrt(2); - -is(12->bfac(), 479001600, '12->bfac() = 479001600'); +is(ref($x), 'Math::BigInt', '$x = 2 ** 255 makes $x a Math::BigInt'); -# see if Math::BigFloat constant works +is(9/4, 2.25, '9/4 = 2.25 as a Math::BigFloat'); -# 0123456789 0123456789 <- default 40 -# 0123456789 0123456789 -is(1/3, '0.3333333333333333333333333333333333333333', '1/3'); +is(4.5 + 4.5, 9, '4.5 + 4.5 = 9'); +#is(ref(4.5 + 4.5), 'Math::BigInt', '4.5 + 4.5 makes a Math::BigInt'); ############################################################################### # accuracy and precision
View file
_service:tar_scm:bignum-0.63.tar.gz/t/bigrat.t -> _service:tar_scm:bignum-0.66.tar.gz/t/bigrat.t
Changed
@@ -5,7 +5,7 @@ use strict; use warnings; -use Test::More tests => 29;; +use Test::More tests => 27; use bigrat; @@ -15,14 +15,10 @@ my $x = 5; is(ref($x), 'Math::BigRat', '$x = 5 makes $x a Math::BigRat'); -is(2 + 2.5, 4.5); # should still work $x = 2 + 3.5; +is($x, 5.5, '2 + 3.5 = 5.5'); is(ref($x), 'Math::BigRat', '$x = 2 + 3.5 makes $x a Math::BigRat'); -is(2 * 2.1, 4.2, '2 * 2.1 = 4.2'); -$x = 2 + 2.1; -is(ref($x), 'Math::BigRat', '$x = 2 + 2.1 makes $x a Math::BigRat'); - $x = 2 ** 255; is(ref($x), 'Math::BigRat', '$x = 2 ** 255 makes $x a Math::BigRat');
View file
_service:tar_scm:bignum-0.66.tar.gz/t/const-bigfloat.t
Added
@@ -0,0 +1,337 @@ +# -*- mode: perl; -*- + +# Binary, octal, and hexadecimal floating point literals were introduced in +# v5.22.0. +# +# - It wasn't until v5.28.0 that binary, octal, and hexadecimal floating point +# literals were converted to the correct value on perls compiled with quadmath +# support. +# +# - It wasn't until v5.32.0 that binary and octal floating point literals worked +# correctly with constant overloading. Before v5.32.0, it seems like the +# second character is always silently converted to an "x", so, e.g., "0b1.1p8" +# is passed to the overload::constant subroutine as "0x1.1p8", and "01.1p+8" +# is passed as "0x.1p+8". +# +# - Octal floating point literals using the "0o" prefix were introduced in +# v5.34.0. + +# Note that all numeric literals that should not be overloaded must be quoted. + +use strict; +use warnings; + +use Test::More tests => "171"; + +use bigfloat; + +my $class = "Math::BigFloat"; +my $x; + +################################################################################ +# The following tests should be identical for Math::BigInt, Math::BigFloat and +# Math::BigRat. + +# These are handled by "binary". + +$x = 0xff; +is($x, "255", "hexadecimal integer literal 0xff"); +is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + +SKIP: { + # Hexadecimal literals using the "0X" prefix require v5.14.0. + skip "perl v5.14.0 required for hexadecimal integer literals" + . " with '0X' prefix", "2" if $ < "5.014"; + + $x = eval "0XFF"; + is($x, "255", "hexadecimal integer literal 0XFF"); + is(ref($x), $class, "value is a $class"); +} + +$x = 0377; +is($x, "255", "octal integer literal 0377"); +is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + +SKIP: { + # Octal literals using the "0o" prefix require v5.34.0. + skip "perl v5.34.0 required for octal floating point literals" + . " with '0o' prefix", "4" if $ < "5.034"; + + for my $str (qw/ 0o377 0O377 /) { + $x = eval $str; + is($x, "255", "octal integer literal $str"); + is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + } +} + +$x = 0b11111111; +is($x, "255", "binary integer literal 0b11111111"); +is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + +SKIP: { + # Binary literals using the "0B" prefix require v5.14.0. + skip "perl v5.14.0 required for binary integer literals" + . " with '0B' prefix", "2" if $ < "5.014"; + + $x = eval "0B11111111"; + is($x, "255", "binary integer literal 0B11111111"); + is(ref($x), $class, "value is a $class"); +} + +# These are handled by "float". + +$x = 999999999999999999999999999999999999999999999999999999999999999999999999; +is($x, + "999999999999999999999999999999999999999999999999999999999999999999999999", + "decimal integer literal " . ("9" x 72)); +is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + +$x = 1e72 - 1; +is($x, + "999999999999999999999999999999999999999999999999999999999999999999999999", + "literal 1e72 - 1"); +is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + +# These are handled by "float". + +SKIP: { + # Hexadecimal floating point literals require v5.28.0. + skip "perl v5.28.0 required for hexadecimal floating point literals", + "6" * "2" + "2" * "2" if $ < "5.028"; + + for my $str (qw/ 0x1.3ap+8 0X1.3AP+8 + 0x1.3ap8 0X1.3AP8 + 0x13a0p-4 0X13A0P-4 /) + { + $x = eval $str; + is($x, "314", "hexadecimal floating point literal $str"); + is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + } + + for my $str (qw/ 0x0.0p+8 0X0.0P+8 /) + { + $x = eval $str; + is($x, "0", "hexadecimal floating point literal $str"); + is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + } +} + +SKIP: { + # Octal floating point literals using the "0o" prefix require v5.34.0. + skip "perl v5.34.0 required for octal floating point literals" + . " with '0o' prefix", "6" * "2" + "6" * "2" if $ < "5.034"; + + for my $str (qw/ 0o1.164p+8 0O1.164P+8 + 0o1.164p8 0O1.164P8 + 0o11640p-4 0O11640P-4 /) + { + $x = eval $str; + is($x, "314", "octal floating point literal $str"); + is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + } + + for my $str (qw/ 0o0.0p+8 0O0.0P+8 + 0o0.0p8 0O0.0P8 + 0o0.0p-8 0O0.0P-8 /) + { + $x = eval $str; + is($x, "0", "octal floating point literal $str"); + is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + } +} + +SKIP: { + # Octal floating point literals using the "0" prefix require v5.32.0. + skip "perl v5.32.0 required for octal floating point literals", + "6" * "2" + "6" * "2" if $ < "5.032"; + + for my $str (qw/ 01.164p+8 01.164P+8 + 01.164p8 01.164P8 + 011640p-4 011640P-4 /) + { + $x = eval $str; + is($x, "314", "octal floating point literal $str"); + is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + } + + for my $str (qw/ 00.0p+8 00.0P+8 + 00.0p8 00.0P8 + 00.0p-8 00.0P-8 /) + { + $x = eval $str; + is($x, "0", "octal floating point literal $str"); + is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + } +} + +SKIP: { + # Binary floating point literals require v5.32.0. + skip "perl v5.32.0 required for binary floating point literals", + "6" * "2" + "6" * "2" if $ < "5.032"; + + for my $str (qw/ 0b1.0011101p+8 0B1.0011101P+8 + 0b1.0011101p8 0B1.0011101P8 + 0b10011101000p-2 0B10011101000P-2 /) + { + $x = eval $str; + is($x, "314", "binary floating point literal $str"); + is(ref($x), "Math::BigFloat", + "value is a Math::BigInt or Math::BigInt::Lite"); + } + + for my $str (qw/ 0b0p+8 0B0P+8 + 0b0p8 0B0P8 + 0b0p-8 0B0P-8 + /) + { + $x = eval $str;
View file
_service:tar_scm:bignum-0.63.tar.gz/t/const-bignum.t -> _service:tar_scm:bignum-0.66.tar.gz/t/const-bignum.t
Changed
@@ -36,7 +36,7 @@ $x = 0xff; is($x, "255", "hexadecimal integer literal 0xff"); -is(ref($x), "Math::BigFloat", +like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); SKIP: { @@ -46,12 +46,13 @@ $x = eval "0XFF"; is($x, "255", "hexadecimal integer literal 0XFF"); - is(ref($x), $class, "value is a $class"); + like(ref($x), qr/^Math::BigInt(::Lite)?$/, + "value is a Math::BigInt or Math::BigInt::Lite"); } $x = 0377; is($x, "255", "octal integer literal 0377"); -is(ref($x), "Math::BigFloat", +like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); SKIP: { @@ -62,14 +63,14 @@ for my $str (qw/ 0o377 0O377 /) { $x = eval $str; is($x, "255", "octal integer literal $str"); - is(ref($x), "Math::BigFloat", - "value is a Math::BigInt or Math::BigInt::Lite"); + like(ref($x), qr/^Math::BigInt(::Lite)?$/, + "value is a Math::BigInt or Math::BigInt::Lite"); } } $x = 0b11111111; is($x, "255", "binary integer literal 0b11111111"); -is(ref($x), "Math::BigFloat", +like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); SKIP: { @@ -79,7 +80,8 @@ $x = eval "0B11111111"; is($x, "255", "binary integer literal 0B11111111"); - is(ref($x), $class, "value is a $class"); + like(ref($x), qr/^Math::BigInt(::Lite)?$/, + "value is a Math::BigInt or Math::BigInt::Lite"); } # These are handled by "float". @@ -88,14 +90,14 @@ is($x, "999999999999999999999999999999999999999999999999999999999999999999999999", "decimal integer literal " . ("9" x 72)); -is(ref($x), "Math::BigFloat", +like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); $x = 1e72 - 1; is($x, "999999999999999999999999999999999999999999999999999999999999999999999999", "literal 1e72 - 1"); -is(ref($x), "Math::BigFloat", +like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); # These are handled by "float". @@ -111,7 +113,7 @@ { $x = eval $str; is($x, "314", "hexadecimal floating point literal $str"); - is(ref($x), "Math::BigFloat", + like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); } @@ -119,7 +121,7 @@ { $x = eval $str; is($x, "0", "hexadecimal floating point literal $str"); - is(ref($x), "Math::BigFloat", + like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); } } @@ -135,7 +137,7 @@ { $x = eval $str; is($x, "314", "octal floating point literal $str"); - is(ref($x), "Math::BigFloat", + like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); } @@ -145,7 +147,7 @@ { $x = eval $str; is($x, "0", "octal floating point literal $str"); - is(ref($x), "Math::BigFloat", + like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); } } @@ -161,7 +163,7 @@ { $x = eval $str; is($x, "314", "octal floating point literal $str"); - is(ref($x), "Math::BigFloat", + like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); } @@ -171,7 +173,7 @@ { $x = eval $str; is($x, "0", "octal floating point literal $str"); - is(ref($x), "Math::BigFloat", + like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); } } @@ -187,7 +189,7 @@ { $x = eval $str; is($x, "314", "binary floating point literal $str"); - is(ref($x), "Math::BigFloat", + like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); } @@ -198,7 +200,7 @@ { $x = eval $str; is($x, "0", "binary floating point literal $str"); - is(ref($x), "Math::BigFloat", + like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); } } @@ -207,12 +209,12 @@ $x = 314; is($x, "314", "integer literal 314"); -is(ref($x), "Math::BigFloat", +like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); $x = 0; is($x, "0", "integer literal 0"); -is(ref($x), "Math::BigFloat", +like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); $x = 2 ** 255; @@ -220,7 +222,7 @@ "578960446186580977117854925043439539266" . "34992332820282019728792003956564819968", "2 ** 255"); -is(ref($x), "Math::BigFloat", +like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); # These are handled by "binary". @@ -233,7 +235,7 @@ is($x, "94522879687365475552814062743484560", "hexadecimal constant 0x123456789012345678901234567890"); - is(ref($x), "Math::BigFloat", + like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); # octal constant @@ -241,7 +243,7 @@ is($x, "1736132869400711976876385488263403729", "octal constant 012345676543210123456765432101234567654321"); - is(ref($x), "Math::BigFloat", + like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); # binary constant @@ -250,7 +252,7 @@ "23755414508757357", "binary constant 0b0101010001100101011011000111" . "0011010010010110000101101101"); - is(ref($x), "Math::BigFloat", + like(ref($x), qr/^Math::BigInt(::Lite)?$/, "value is a Math::BigInt or Math::BigInt::Lite"); }
View file
_service:tar_scm:bignum-0.66.tar.gz/t/down-mbi-up-mbf.t
Added
@@ -0,0 +1,58 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More tests => 14; + +use bignum; + +is(bignum -> downgrade(), "Math::BigInt", + "bignum's downgrade class is Math::BigInt"); +is(bignum -> upgrade(), "Math::BigFloat", + "bignum's upgrade class is Math::BigFloat"); + +is(Math::BigFloat -> downgrade(), "Math::BigInt", + "Math::BigFloat's downgrade class is Math::BigInt"); +is(Math::BigInt -> upgrade(), "Math::BigFloat", + "Math::BigInt's upgrade class is Math::BigFloat"); + +my $i1 = 7; +my $i2 = 2; +my $f1 = 3.75; +my $f2 = 1.25; + +is(ref($i1), "Math::BigInt", "literal $i1 is a Math::BigInt"); +is(ref($f1), "Math::BigFloat", "literal $f1 is a Math::BigFloat"); + +# Verify that the result is upgraded to a Math::BigFloat. + +cmp_ok($i1/$i2, "==", "3.5", "$i1/$i2 is 3.5"); +is(ref($i1/$i2), "Math::BigFloat", "$i1/$i2 is 3.5 as a Math::BigFloat"); + +# Verify that the result is downgraded to a Math::BigInt. + +cmp_ok($f1/$f2, "==", "3", "$f1/$f2 is 3"); +is(ref($f1/$f2), "Math::BigInt", "$f1/$f2 is 3 as a Math::BigInt"); + +# Change the upgrade class during runtime. + +SKIP: { + eval "use Math::BigRat"; + skip "Math::BigRat not installed", 4 if $@; + + bignum -> upgrade("Math::BigRat"); + + my $r1 = 3.75; + my $r2 = 1.25; + + # Verify that the result is upgraded to a Math::BigRat. + + cmp_ok($i1/$i2, "==", "3.5", "$i1/$i2 is 3.5"); + is(ref($i1/$i2), "Math::BigRat", "$i1/$i2 is 3.5 as a Math::BigRat"); + + # Verify that the result is downgraded to a Math::BigInt. + + cmp_ok($r1/$r2, "==", "3", "($r1)/($r2) is 3"); + is(ref($r1/$r2), "Math::BigInt", "($r1)/($r2) is 3 as a Math::BigInt"); +};
View file
_service:tar_scm:bignum-0.66.tar.gz/t/down-mbi-up-mbr.t
Added
@@ -0,0 +1,43 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval "use Math::BigRat"; + plan skip_all => 'Math::BigRat required for these tests' if $@; +} + +plan tests => 10; + +use bignum upgrade => "Math::BigRat"; + +is(bignum -> downgrade(), "Math::BigInt", + "bignum's upgrade class is Math::BigInt"); +is(bignum -> upgrade(), "Math::BigRat", + "bignum's downgrade class is Math::BigInt"); + +is(Math::BigInt -> upgrade(), "Math::BigRat", + "Math::BigInt's upgrade class is Math::BigRat"); +is(Math::BigRat -> downgrade(), "Math::BigInt", + "Math::BigRat's downgrade class is Math::BigInt"); + +my $i1 = 7; +my $i2 = 2; +my $r1 = 3.75; +my $r2 = 1.25; + +is(ref($i1), "Math::BigInt", "literal $i1 is a Math::BigInt"); +is(ref($r1), "Math::BigRat", "literal $r1 is a Math::BigRat"); + +# Verify that the result is upgraded to a Math::BigRat. + +cmp_ok($i1/$i2, "==", "3.5", "$i1/$i2 is 3.5"); +is(ref($i1/$i2), "Math::BigRat", "$i1/$i2 is 3.5 as a Math::BigRat"); + +# Verify that the result is downgraded to a Math::BigInt. + +cmp_ok($r1/$r2, "==", "3", "($r1)/($r2) is 3"); +is(ref($r1/$r2), "Math::BigInt", "($r1)/($r2) is 3 as a Math::BigInt");
View file
_service:tar_scm:bignum-0.66.tar.gz/t/down-mbi-up-undef.t
Added
@@ -0,0 +1,45 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval "use Math::BigRat"; + plan skip_all => 'Math::BigRat required for these tests' if $@; +} + +plan tests => 10; + +use bignum upgrade => undef; + +is(bignum -> downgrade(), "Math::BigInt", + "bignum's upgrade class is Math::BigInt"); +is(bignum -> upgrade(), undef, + "bignum's downgrade class is undefined"); + +is(Math::BigInt -> upgrade(), undef, + "Math::BigInt's upgrade class is undefined"); +is(Math::BigFloat -> downgrade(), "Math::BigInt", + "Math::BigFloat's downgrade class is Math::BigInt"); + +my $i1 = 7; +my $i2 = 2; +my $f1 = 3.75; +my $f2 = 1.25; + +is(ref($i1), "Math::BigInt", "literal $i1 is a Math::BigInt"); +is(ref($f1), "Math::BigFloat", "literal $f1 is a Math::BigFloat"); + +# Verify that the result is not upgraded to a Math::BigFloat. + +cmp_ok($i1/$i2, "==", "3", "$i1/$i2 is 3"); +is(ref($i1/$i2), "Math::BigInt", + "$i1/$i2 is 3 as a Math::BigInt due to no upgrading"); + +# Verify that the result is downgraded to a Math::BigInt. + +cmp_ok($f1/$f2, "==", "3", "$f1/$f2 is 3"); +is(ref($f1/$f2), "Math::BigInt", + "$f1/$f2 is 3 as a Math::BigInt due to downgrading");
View file
_service:tar_scm:bignum-0.66.tar.gz/t/down-undef-up-mbf.t
Added
@@ -0,0 +1,38 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More tests => 10; + +use bignum downgrade => undef; + +is(bignum -> downgrade(), undef, + "bignum's downgrade class is undefined"); +is(bignum -> upgrade(), "Math::BigFloat", + "bignum's upgrade class is Math::BigFloat"); + +is(Math::BigFloat -> downgrade(), undef, + "Math::BigFloat's downgrade class is undefined"); +is(Math::BigInt -> upgrade(), "Math::BigFloat", + "Math::BigInt's upgrade class is Math::BigFloat"); + +my $i1 = 7; +my $i2 = 2; +my $f1 = 3.75; +my $f2 = 1.25; + +is(ref($i1), "Math::BigInt", "literal $i1 is a Math::BigInt"); +is(ref($f1), "Math::BigFloat", "literal $f1 is a Math::BigFloat"); + +# Verify that the result is upgraded to a Math::BigFloat. + +cmp_ok($i1/$i2, "==", "3.5", "$i1/$i2 is 3.5"); +is(ref($i1/$i2), "Math::BigFloat", + "$i1/$i2 is 3.5 as a Math::BigFloat due to upgrading"); + +# Verify that the result is not downgraded to a Math::BigInt. + +cmp_ok($f1/$f2, "==", "3", "$f1/$f2 is 3"); +is(ref($f1/$f2), "Math::BigFloat", + "$f1/$f2 is 3 as a Math::BigFloat due to no downgrading");
View file
_service:tar_scm:bignum-0.66.tar.gz/t/e_pi-bigfloat.t
Added
@@ -0,0 +1,17 @@ +# -*- mode: perl; -*- + +############################################################################### +# test for e() and PI() exports + +use strict; +use warnings; + +use Test::More tests => 4; + +use bigfloat qw/e PI bexp bpi/; + +is(e, "2.718281828459045235360287471352662497757", 'e'); +is(PI, "3.141592653589793238462643383279502884197", 'PI'); + +is(bexp(1, 10), "2.718281828", 'bexp(1, 10)'); +is(bpi(10), "3.141592654", 'bpi(10)');
View file
_service:tar_scm:bignum-0.66.tar.gz/t/import-bigfloat.t
Added
@@ -0,0 +1,63 @@ +# -*- mode: perl; -*- + +# test the "l", "lib", "try" and "only" options: + +use strict; +use warnings; + +use Test::More tests => 21; + +use bigfloat; + +# Catch warnings. + +my $WARNINGS; +local $SIG{__WARN__} = sub { + $WARNINGS = $_0; +}; + +my $rc; + +$WARNINGS = ""; +$rc = eval { bigfloat -> import("l" => "foo") }; +is($@, '', + qq|eval { bigfloat -> import("l" => "foo") }|); +is($WARNINGS, "", "no warnings"); + +$WARNINGS = ""; +$rc = eval { bigfloat -> import("lib" => "foo") }; +is($@, '', + qq|eval { bigfloat -> import("lib" => "foo") }|); +is($WARNINGS, "", "no warnings"); + +$WARNINGS = ""; +$rc = eval { bigfloat -> import("try" => "foo") }; +is($@, '', + qq|eval { bigfloat -> import("try" => "foo") }|); +is($WARNINGS, "", "no warnings"); + +$WARNINGS = ""; +$rc = eval { bigfloat -> import("try" => "foo") }; +is($@, '', + qq|eval { bigfloat -> import("try" => "foo") }|); +is($WARNINGS, "", "no warnings"); + +$WARNINGS = ""; +$rc = eval { bigfloat -> import("foo" => "bar") }; +like($@, qr/^Unknown option/, + qq|eval { bigfloat -> import("foo" => "bar") }|); +is($WARNINGS, "", "no warnings"); + +$WARNINGS = ""; +$rc = eval { bigfloat -> import("only" => "bar") }; +is($@, "", + qq|eval { bigfloat -> import("only" => "bar") }|); +is($WARNINGS, "", "no warnings"); + +# test that options are only lowercase (don't see a reason why allow UPPER) + +foreach (qw/L LIB Lib T Trace TRACE V Version VERSION/) { + $rc = eval { bigfloat -> import($_ => "bar") }; + like($@, qr/^Unknown option/i, # should die + qq|eval { bigfloat -> import($_ => "bar") }|); +}
View file
_service:tar_scm:bignum-0.63.tar.gz/t/in_effect.t -> _service:tar_scm:bignum-0.66.tar.gz/t/in_effect.t
Changed
@@ -17,7 +17,7 @@ skip('Need at least Perl v5.9.4', 3) if $ < "5.009005"; is(bigint::in_effect(), 1, 'bigint in effect'); - is(bignum::in_effect(), undef, 'bignum not in effect'); + is(bigfloat::in_effect(), undef, 'bigfloat not in effect'); is(bigrat::in_effect(), undef, 'bigint not in effect'); } @@ -25,29 +25,29 @@ no bigint; is(bigint::in_effect(), undef, 'bigint not in effect'); - is(bignum::in_effect(), undef, 'bignum not in effect'); + is(bigfloat::in_effect(), undef, 'bigfloat not in effect'); is(bigrat::in_effect(), undef, 'bigrat not in effect'); } } { - use bignum; + use bigfloat; - can_ok('bignum', qw/in_effect/); + can_ok('bigfloat', qw/in_effect/); SKIP: { skip('Need at least Perl v5.9.4', 3) if $ < "5.009005"; is(bigint::in_effect(), undef, 'bigint not in effect'); - is(bignum::in_effect(), 1, 'bignum in effect'); + is(bigfloat::in_effect(), 1, 'bigfloat in effect'); is(bigrat::in_effect(), undef, 'bigint not in effect'); } { - no bignum; + no bigfloat; is(bigint::in_effect(), undef, 'bigint not in effect'); - is(bignum::in_effect(), undef, 'bignum not in effect'); + is(bigfloat::in_effect(), undef, 'bigfloat not in effect'); is(bigrat::in_effect(), undef, 'bigrat not in effect'); } } @@ -61,7 +61,7 @@ skip('Need at least Perl v5.9.4', 3) if $ < "5.009005"; is(bigint::in_effect(), undef, 'bigint not in effect'); - is(bignum::in_effect(), undef, 'bignum not in effect'); + is(bigfloat::in_effect(), undef, 'bigfloat not in effect'); is(bigrat::in_effect(), 1, 'bigint in effect'); } @@ -69,7 +69,7 @@ no bigrat; is(bigint::in_effect(), undef, 'bigint not in effect'); - is(bignum::in_effect(), undef, 'bignum not in effect'); + is(bigfloat::in_effect(), undef, 'bigfloat not in effect'); is(bigrat::in_effect(), undef, 'bigrat not in effect'); } }
View file
_service:tar_scm:bignum-0.66.tar.gz/t/infnan-bigfloat.t
Added
@@ -0,0 +1,100 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More tests => 66; + +use bigfloat; + +my $class = "Math::BigFloat"; +my $x; + +############################################################################### + +note("inf tests"); + +$x = 1 + inf; +note("\n\n" . $x . "\n\n"); + +$x = 1 + inf; +is(ref($x), $class, "\$x = 1 + inf makes a $class"); +is($x->bstr(), "inf", '$x = 1 + inf; $x->bstr() = "inf"'); + +$x = 1 * inf; +is(ref($x), $class, "\$x = 1 * inf makes a $class"); +is($x->bstr(), "inf", '$x = 1 * inf; $x->bstr() = "inf"'); + +# these don't work without exporting inf() +$x = inf; +is(ref($x), $class, "\$x = inf makes a $class"); +is($x->bstr(), "inf", '$x = inf; $x->bstr() = "inf"'); + +$x = inf + inf; +is(ref($x), $class, "\$x = inf + inf makes a $class"); +is($x->bstr(), "inf", '$x = inf + inf; $x->bstr() = "inf"'); + +$x = inf * inf; +is(ref($x), $class, "\$x = inf * inf makes a $class"); +is($x->bstr(), "inf", '$x = inf * inf; $x->bstr() = "inf"'); + +############################################################################### + +note("NaN tests"); + +$x = 1 + NaN; +is(ref($x), $class, "\$x = 1 + NaN makes a $class"); +is($x->bstr(), "NaN", '$x = 1 + NaN; $x->bstr() = "NaN"'); + +$x = 1 * NaN; +is(ref($x), $class, "\$x = 1 * NaN makes a $class"); +is($x->bstr(), "NaN", '$x = 1 * NaN; $x->bstr() = "NaN"'); + +# these don't work without exporting NaN() +$x = NaN; +is(ref($x), $class, "\$x = NaN makes a $class"); +is($x->bstr(), "NaN", '$x = NaN; $x->bstr() = "NaN"'); + +$x = NaN + NaN; +is(ref($x), $class, "\$x = NaN + NaN makes a $class"); +is($x->bstr(), "NaN", '$x = NaN + NaN; $x->bstr() = "NaN"'); + +$x = NaN * NaN; +is(ref($x), $class, "\$x = NaN * NaN makes a $class"); +is($x->bstr(), "NaN", '$x = NaN * NaN; $x->bstr() = "NaN"'); + +############################################################################### + +note("mixed tests"); + +# these don't work without exporting NaN() or inf() + +$x = NaN + inf; +is(ref($x), $class, "\$x = NaN + inf makes a $class"); +is($x->bstr(), "NaN", '$x = NaN + inf; $x->bstr() = "NaN"'); + +$x = NaN * inf; +is(ref($x), $class, "\$x = NaN * inf makes a $class"); +is($x->bstr(), "NaN", '$x = NaN * inf; $x->bstr() = "NaN"'); + +$x = inf * NaN; +is(ref($x), $class, "\$x = inf * NaN makes a $class"); +is($x->bstr(), "NaN", '$x = inf * NaN; $x->bstr() = "NaN"'); + +############################################################################### +# inf and NaN as strings. + +for my $nan (qw/ nan naN nAn nAN Nan NaN NAn NAN /) { + my $x = 1 + $nan; + is($x->bstr(), "NaN", qq|\$x = 1 + "$nan"|); + is(ref($x), $class, "\$x is a $class"); +} + +for my $inf (qw/ inf inF iNf iNF Inf InF INf INF + infinity Infinity InFiNiTy iNfInItY + /) +{ + my $x = 1 + $inf; + is($x->bstr(), "inf", qq|\$x = 1 + "$inf"|); + is(ref($x), $class, "\$x is a $class"); +}
View file
_service:tar_scm:bignum-0.66.tar.gz/t/infnan-bignum-mbf.t
Added
@@ -0,0 +1,101 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More tests => 66; + +# Default: upgrade => "Math::BigFloat", downgrade => "Math::BigInt"; +use bignum; + +my $class = "Math::BigInt"; +my $x; + +############################################################################### + +note("inf tests"); + +$x = 1 + inf; +note("\n\n" . $x . "\n\n"); + +$x = 1 + inf; +is(ref($x), $class, "\$x = 1 + inf makes a $class"); +is($x->bstr(), "inf", '$x = 1 + inf; $x->bstr() = "inf"'); + +$x = 1 * inf; +is(ref($x), $class, "\$x = 1 * inf makes a $class"); +is($x->bstr(), "inf", '$x = 1 * inf; $x->bstr() = "inf"'); + +# these don't work without exporting inf() +$x = inf; +is(ref($x), $class, "\$x = inf makes a $class"); +is($x->bstr(), "inf", '$x = inf; $x->bstr() = "inf"'); + +$x = inf + inf; +is(ref($x), $class, "\$x = inf + inf makes a $class"); +is($x->bstr(), "inf", '$x = inf + inf; $x->bstr() = "inf"'); + +$x = inf * inf; +is(ref($x), $class, "\$x = inf * inf makes a $class"); +is($x->bstr(), "inf", '$x = inf * inf; $x->bstr() = "inf"'); + +############################################################################### + +note("NaN tests"); + +$x = 1 + NaN; +is(ref($x), $class, "\$x = 1 + NaN makes a $class"); +is($x->bstr(), "NaN", '$x = 1 + NaN; $x->bstr() = "NaN"'); + +$x = 1 * NaN; +is(ref($x), $class, "\$x = 1 * NaN makes a $class"); +is($x->bstr(), "NaN", '$x = 1 * NaN; $x->bstr() = "NaN"'); + +# these don't work without exporting NaN() +$x = NaN; +is(ref($x), $class, "\$x = NaN makes a $class"); +is($x->bstr(), "NaN", '$x = NaN; $x->bstr() = "NaN"'); + +$x = NaN + NaN; +is(ref($x), $class, "\$x = NaN + NaN makes a $class"); +is($x->bstr(), "NaN", '$x = NaN + NaN; $x->bstr() = "NaN"'); + +$x = NaN * NaN; +is(ref($x), $class, "\$x = NaN * NaN makes a $class"); +is($x->bstr(), "NaN", '$x = NaN * NaN; $x->bstr() = "NaN"'); + +############################################################################### + +note("mixed tests"); + +# these don't work without exporting NaN() or inf() + +$x = NaN + inf; +is(ref($x), $class, "\$x = NaN + inf makes a $class"); +is($x->bstr(), "NaN", '$x = NaN + inf; $x->bstr() = "NaN"'); + +$x = NaN * inf; +is(ref($x), $class, "\$x = NaN * inf makes a $class"); +is($x->bstr(), "NaN", '$x = NaN * inf; $x->bstr() = "NaN"'); + +$x = inf * NaN; +is(ref($x), $class, "\$x = inf * NaN makes a $class"); +is($x->bstr(), "NaN", '$x = inf * NaN; $x->bstr() = "NaN"'); + +############################################################################### +# inf and NaN as strings. + +for my $nan (qw/ nan naN nAn nAN Nan NaN NAn NAN /) { + my $x = 1 + $nan; + is($x->bstr(), "NaN", qq|\$x = 1 + "$nan"|); + is(ref($x), $class, "\$x is a $class"); +} + +for my $inf (qw/ inf inF iNf iNF Inf InF INf INF + infinity Infinity InFiNiTy iNfInItY + /) +{ + my $x = 1 + $inf; + is($x->bstr(), "inf", qq|\$x = 1 + "$inf"|); + is(ref($x), $class, "\$x is a $class"); +}
View file
_service:tar_scm:bignum-0.66.tar.gz/t/infnan-bignum-mbr.t
Added
@@ -0,0 +1,101 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More tests => 66; + +# Default: upgrade => "Math::BigFloat", downgrade => "Math::BigInt"; +use bignum upgrade => "Math::BigRat"; + +my $class = "Math::BigInt"; +my $x; + +############################################################################### + +note("inf tests"); + +$x = 1 + inf; +note("\n\n" . $x . "\n\n"); + +$x = 1 + inf; +is(ref($x), $class, "\$x = 1 + inf makes a $class"); +is($x->bstr(), "inf", '$x = 1 + inf; $x->bstr() = "inf"'); + +$x = 1 * inf; +is(ref($x), $class, "\$x = 1 * inf makes a $class"); +is($x->bstr(), "inf", '$x = 1 * inf; $x->bstr() = "inf"'); + +# these don't work without exporting inf() +$x = inf; +is(ref($x), $class, "\$x = inf makes a $class"); +is($x->bstr(), "inf", '$x = inf; $x->bstr() = "inf"'); + +$x = inf + inf; +is(ref($x), $class, "\$x = inf + inf makes a $class"); +is($x->bstr(), "inf", '$x = inf + inf; $x->bstr() = "inf"'); + +$x = inf * inf; +is(ref($x), $class, "\$x = inf * inf makes a $class"); +is($x->bstr(), "inf", '$x = inf * inf; $x->bstr() = "inf"'); + +############################################################################### + +note("NaN tests"); + +$x = 1 + NaN; +is(ref($x), $class, "\$x = 1 + NaN makes a $class"); +is($x->bstr(), "NaN", '$x = 1 + NaN; $x->bstr() = "NaN"'); + +$x = 1 * NaN; +is(ref($x), $class, "\$x = 1 * NaN makes a $class"); +is($x->bstr(), "NaN", '$x = 1 * NaN; $x->bstr() = "NaN"'); + +# these don't work without exporting NaN() +$x = NaN; +is(ref($x), $class, "\$x = NaN makes a $class"); +is($x->bstr(), "NaN", '$x = NaN; $x->bstr() = "NaN"'); + +$x = NaN + NaN; +is(ref($x), $class, "\$x = NaN + NaN makes a $class"); +is($x->bstr(), "NaN", '$x = NaN + NaN; $x->bstr() = "NaN"'); + +$x = NaN * NaN; +is(ref($x), $class, "\$x = NaN * NaN makes a $class"); +is($x->bstr(), "NaN", '$x = NaN * NaN; $x->bstr() = "NaN"'); + +############################################################################### + +note("mixed tests"); + +# these don't work without exporting NaN() or inf() + +$x = NaN + inf; +is(ref($x), $class, "\$x = NaN + inf makes a $class"); +is($x->bstr(), "NaN", '$x = NaN + inf; $x->bstr() = "NaN"'); + +$x = NaN * inf; +is(ref($x), $class, "\$x = NaN * inf makes a $class"); +is($x->bstr(), "NaN", '$x = NaN * inf; $x->bstr() = "NaN"'); + +$x = inf * NaN; +is(ref($x), $class, "\$x = inf * NaN makes a $class"); +is($x->bstr(), "NaN", '$x = inf * NaN; $x->bstr() = "NaN"'); + +############################################################################### +# inf and NaN as strings. + +for my $nan (qw/ nan naN nAn nAN Nan NaN NAn NAN /) { + my $x = 1 + $nan; + is($x->bstr(), "NaN", qq|\$x = 1 + "$nan"|); + is(ref($x), $class, "\$x is a $class"); +} + +for my $inf (qw/ inf inF iNf iNF Inf InF INf INF + infinity Infinity InFiNiTy iNfInItY + /) +{ + my $x = 1 + $inf; + is($x->bstr(), "inf", qq|\$x = 1 + "$inf"|); + is(ref($x), $class, "\$x is a $class"); +}
View file
_service:tar_scm:bignum-0.66.tar.gz/t/option_a-bignum.t
Added
@@ -0,0 +1,18 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More tests => 4; + +{ + use bignum a => "12"; + for my $class ("Math::BigInt", "Math::BigFloat") { + cmp_ok($class -> accuracy(), "==", 12, "$class accuracy = 12"); + } + + bignum -> import(accuracy => "23"); + for my $class ("Math::BigInt", "Math::BigFloat") { + cmp_ok($class -> accuracy(), "==", 23, "$class accuracy = 23"); + } +}
View file
_service:tar_scm:bignum-0.63.tar.gz/t/option_a.t -> _service:tar_scm:bignum-0.66.tar.gz/t/option_a.t
Changed
@@ -18,19 +18,19 @@ { my $class = "Math::BigFloat"; - use bignum a => "12"; - cmp_ok($class -> accuracy(), "==", 12, "$class accuracy = 12"); + use bigfloat a => "13"; + cmp_ok($class -> accuracy(), "==", 13, "$class accuracy = 12"); - bignum -> import(accuracy => "23"); - cmp_ok($class -> accuracy(), "==", 23, "$class accuracy = 23"); + bigfloat -> import(accuracy => "24"); + cmp_ok($class -> accuracy(), "==", 24, "$class accuracy = 23"); } { my $class = "Math::BigRat"; - use bigrat a => "12"; - cmp_ok($class -> accuracy(), "==", 12, "$class accuracy = 12"); + use bigrat a => "14"; + cmp_ok($class -> accuracy(), "==", 14, "$class accuracy = 12"); - bigrat -> import(accuracy => "23"); - cmp_ok($class -> accuracy(), "==", 23, "$class accuracy = 23"); + bigrat -> import(accuracy => "25"); + cmp_ok($class -> accuracy(), "==", 25, "$class accuracy = 23"); }
View file
_service:tar_scm:bignum-0.66.tar.gz/t/option_l-bigfloat.t
Added
@@ -0,0 +1,72 @@ +# -*- mode: perl; -*- + +# test the "l", "lib", "try" and "only" options: + +use strict; +use warnings; + +use Test::More tests => 14; + +use bigfloat; + +# Catch warning. + +my $warning; +local $SIG{__WARN__} = sub { + $warning = $_0; +}; + +my $rc; + +$warning = ""; +$rc = eval { bigfloat->import("l" => "foo") }; +subtest qq|eval { bigfloat->import("l" => "foo") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +$warning = ""; +$rc = eval { bigfloat->import("lib" => "foo") }; +subtest qq|eval { bigfloat->import("lib" => "foo") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +$warning = ""; +$rc = eval { bigfloat->import("try" => "foo") }; +subtest qq|eval { bigfloat->import("try" => "foo") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +$warning = ""; +$rc = eval { bigfloat->import("only" => "foo") }; +subtest qq|eval { bigfloat->import("only" => "foo") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +$warning = ""; +$rc = eval { bigfloat->import("foo" => "bar") }; +subtest qq|eval { bigfloat->import("foo" => "bar") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +# test that options are only lowercase (don't see a reason why allow UPPER) + +foreach (qw/L LIB Lib T Trace TRACE V Version VERSION/) { + $rc = eval { bigfloat->import($_ => "bar") }; + like($@, qr/^Unknown option /i, + qq|eval { bigfloat->import($_ => "bar") }|); +}
View file
_service:tar_scm:bignum-0.66.tar.gz/t/option_l-bigint.t
Added
@@ -0,0 +1,72 @@ +# -*- mode: perl; -*- + +# test the "l", "lib", "try" and "only" options: + +use strict; +use warnings; + +use Test::More tests => 14; + +use bigint; + +# Catch warning. + +my $warning; +local $SIG{__WARN__} = sub { + $warning = $_0; +}; + +my $rc; + +$warning = ""; +$rc = eval { bigint->import("l" => "foo") }; +subtest qq|eval { bigint->import("l" => "foo") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +$warning = ""; +$rc = eval { bigint->import("lib" => "foo") }; +subtest qq|eval { bigint->import("lib" => "foo") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +$warning = ""; +$rc = eval { bigint->import("try" => "foo") }; +subtest qq|eval { bigint->import("try" => "foo") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +$warning = ""; +$rc = eval { bigint->import("only" => "foo") }; +subtest qq|eval { bigint->import("only" => "foo") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +$warning = ""; +$rc = eval { bigint->import("foo" => "bar") }; +subtest qq|eval { bigint->import("foo" => "bar") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +# test that options are only lowercase (don't see a reason why allow UPPER) + +foreach (qw/L LIB Lib T Trace TRACE V Version VERSION/) { + $rc = eval { bigint->import($_ => "bar") }; + like($@, qr/^Unknown option /i, + qq|eval { bigint->import($_ => "bar") }|); +}
View file
_service:tar_scm:bignum-0.66.tar.gz/t/option_l-bignum.t
Changed
(renamed from t/option_l.t)
View file
_service:tar_scm:bignum-0.66.tar.gz/t/option_l-bigrat.t
Added
@@ -0,0 +1,72 @@ +# -*- mode: perl; -*- + +# test the "l", "lib", "try" and "only" options: + +use strict; +use warnings; + +use Test::More tests => 14; + +use bigrat; + +# Catch warning. + +my $warning; +local $SIG{__WARN__} = sub { + $warning = $_0; +}; + +my $rc; + +$warning = ""; +$rc = eval { bigrat->import("l" => "foo") }; +subtest qq|eval { bigrat->import("l" => "foo") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +$warning = ""; +$rc = eval { bigrat->import("lib" => "foo") }; +subtest qq|eval { bigrat->import("lib" => "foo") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +$warning = ""; +$rc = eval { bigrat->import("try" => "foo") }; +subtest qq|eval { bigrat->import("try" => "foo") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +$warning = ""; +$rc = eval { bigrat->import("only" => "foo") }; +subtest qq|eval { bigrat->import("only" => "foo") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +$warning = ""; +$rc = eval { bigrat->import("foo" => "bar") }; +subtest qq|eval { bigrat->import("foo" => "bar") }| => sub { + plan tests => 2; + + is($@, '', "didn't die"); + is($warning, "", "didn't get a warning"); +}; + +# test that options are only lowercase (don't see a reason why allow UPPER) + +foreach (qw/L LIB Lib T Trace TRACE V Version VERSION/) { + $rc = eval { bigrat->import($_ => "bar") }; + like($@, qr/^Unknown option /i, + qq|eval { bigrat->import($_ => "bar") }|); +}
View file
_service:tar_scm:bignum-0.66.tar.gz/t/option_p-bignum.t
Added
@@ -0,0 +1,18 @@ +# -*- mode: perl; -*- + +use strict; +use warnings; + +use Test::More tests => 4; + +{ + use bignum p => "12"; + for my $class ("Math::BigInt", "Math::BigFloat") { + cmp_ok($class -> precision(), "==", 12, "$class precision = 12"); + } + + bignum -> import(precision => "23"); + for my $class ("Math::BigInt", "Math::BigFloat") { + cmp_ok($class -> precision(), "==", 23, "$class precision = 23"); + } +}
View file
_service:tar_scm:bignum-0.63.tar.gz/t/option_p.t -> _service:tar_scm:bignum-0.66.tar.gz/t/option_p.t
Changed
@@ -18,19 +18,19 @@ { my $class = "Math::BigFloat"; - use bignum p => "12"; - cmp_ok($class -> precision(), "==", 12, "$class precision = 12"); + use bigfloat p => "13"; + cmp_ok($class -> precision(), "==", 13, "$class precision = 12"); - bignum -> import(precision => "23"); - cmp_ok($class -> precision(), "==", 23, "$class precision = 23"); + bigfloat -> import(precision => "24"); + cmp_ok($class -> precision(), "==", 24, "$class precision = 23"); } { my $class = "Math::BigRat"; - use bigrat p => "12"; - cmp_ok($class -> precision(), "==", 12, "$class precision = 12"); + use bigrat p => "14"; + cmp_ok($class -> precision(), "==", 14, "$class precision = 12"); - bigrat -> import(precision => "23"); - cmp_ok($class -> precision(), "==", 23, "$class precision = 23"); + bigrat -> import(precision => "25"); + cmp_ok($class -> precision(), "==", 25, "$class precision = 23"); }
View file
_service:tar_scm:bignum-0.63.tar.gz/t/overrides.t -> _service:tar_scm:bignum-0.66.tar.gz/t/overrides.t
Changed
@@ -35,27 +35,27 @@ { skip "no lexical hex/oct", 2 unless $ > "5.009004"; is ref hex(1), 'Math::BigInt', - 'bigint hex() works when bignum and bigrat are loaded'; + 'bigint hex() works when bigfloat and bigrat are loaded'; is ref oct(1), 'Math::BigInt', - 'bigint oct() works when bignum and bigrat are loaded'; + 'bigint oct() works when bigfloat and bigrat are loaded'; } } { - use bignum; + use bigfloat; $_ = "20"; - is hex, "32", 'bignum hex override without arguments infers $_'; - is oct, "16", 'bignum oct override without arguments infers $_'; + is hex, "32", 'bigfloat hex override without arguments infers $_'; + is oct, "16", 'bigfloat oct override without arguments infers $_'; @_ = 1..20; - is hex(@_), "32", 'bignum hex override provides scalar context'; - is oct(@_), "16", 'bignum oct override provides scalar context'; + is hex(@_), "32", 'bigfloat hex override provides scalar context'; + is oct(@_), "16", 'bigfloat oct override provides scalar context'; SKIP: { skip "no lexical hex/oct", 2 unless $ > "5.009004"; is ref hex(1), 'Math::BigFloat', - 'bignum hex() works when bigint and bigrat are loaded'; + 'bigfloat hex() works when bigint and bigrat are loaded'; is ref oct(1), 'Math::BigFloat', - 'bignum oct() works when bigint and bigrat are loaded'; + 'bigfloat oct() works when bigint and bigrat are loaded'; } } @@ -71,9 +71,9 @@ { skip "no lexical hex/oct", 2 unless $ > "5.009004"; is ref hex(1), 'Math::BigRat', - 'bigrat hex() works when bignum and bigint are loaded'; + 'bigrat hex() works when bigfloat and bigint are loaded'; is ref oct(1), 'Math::BigRat', - 'bigrat oct() works when bignum and bigint are loaded'; + 'bigrat oct() works when bigfloat and bigint are loaded'; } } @@ -99,11 +99,11 @@ { package _importer2; - use bignum 'hex', 'oct'; - ::is \&hex, \&bignum::hex, 'bignum exports hex'; - ::is \&oct, \&bignum::oct, 'bignum exports oct'; -# ::is \&hex, \&bigint::hex, 'bignum exports same hex as bigint'; -# ::is \&oct, \&bigint::oct, 'bignum exports same oct as bigint'; + use bigfloat 'hex', 'oct'; + ::is \&hex, \&bigfloat::hex, 'bigfloat exports hex'; + ::is \&oct, \&bigfloat::oct, 'bigfloat exports oct'; +# ::is \&hex, \&bigint::hex, 'bigfloat exports same hex as bigint'; +# ::is \&oct, \&bigint::oct, 'bigfloat exports same oct as bigint'; } {
View file
_service:tar_scm:bignum-0.66.tar.gz/t/scope-bigfloat.t
Added
@@ -0,0 +1,35 @@ +# -*- mode: perl; -*- + +############################################################################### +# Test "no bigfloat;" and overloading of hex()/oct() for newer Perls + +use strict; +use warnings; + +use Test::More tests => 10; + +# no :hex and :oct means these do not get overloaded for older Perls: +use bigfloat; + +isnt(ref(1), '', 'is in effect'); +isnt(ref(2.0), '', 'is in effect'); +isnt(ref(0x20), '', 'is in effect'); + +SKIP: { + # Quote numbers due to "use bigfloat;" + skip('Need at least Perl v5.9.4', "2") if $ < "5.009004"; + + is(ref(hex(9)), 'Math::BigFloat', 'hex is overloaded'); + is(ref(oct(07)), 'Math::BigFloat', 'oct is overloaded'); +} + +{ + no bigfloat; + + is(ref(1), '', 'is not in effect'); + is(ref(2.0), '', 'is not in effect'); + is(ref(0x20), '', 'is not in effect'); + + is(ref(hex(9)), '', 'hex is not overloaded'); + is(ref(oct(07)), '', 'oct is not overloaded'); +}
View file
_service:tar_scm:bignum-0.63.tar.gz/t/scope-bignum.t -> _service:tar_scm:bignum-0.66.tar.gz/t/scope-bignum.t
Changed
@@ -19,8 +19,8 @@ # Quote numbers due to "use bignum;" skip('Need at least Perl v5.9.4', "2") if $ < "5.009004"; - is(ref(hex(9)), 'Math::BigFloat', 'hex is overloaded'); - is(ref(oct(07)), 'Math::BigFloat', 'oct is overloaded'); + is(ref(hex(9)), 'Math::BigInt', 'hex is overloaded'); + is(ref(oct(07)), 'Math::BigInt', 'oct is overloaded'); } {
View file
_service:tar_scm:bignum-0.63.tar.gz/t/scope-nested-const.t -> _service:tar_scm:bignum-0.66.tar.gz/t/scope-nested-const.t
Changed
@@ -3,220 +3,272 @@ use strict; use warnings; -use Test::More tests => 48; +use Test::More; -note "\nbigint -> bignum -> bigrat\n\n"; +plan skip_all => 'Need at least Perl v5.10.1' if $ < "5.010001"; + +plan tests => 96; + +note "\nbigint -> bigfloat -> bigrat\n\n"; { note "use bigint;"; use bigint; - is(ref(1), "Math::BigInt"); + is(ref(hex("1")), "Math::BigInt", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigInt", 'ref(oct("1"))'); { - note "use bignum;"; - use bignum; - is(ref(1), "Math::BigFloat"); + note "use bigfloat;"; + use bigfloat; + is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); { note "use bigrat;"; use bigrat; - is(ref(1), "Math::BigRat"); + is(ref(hex("1")), "Math::BigRat", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigRat", 'ref(oct("1"))'); note "no bigrat;"; no bigrat; - is(ref(1), ""); + is(ref(hex("1")), "", 'ref(hex("1"))'); + is(ref(oct("1")), "", 'ref(oct("1"))'); } - is(ref(1), "Math::BigFloat"); + is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); - note "no bignum;"; - no bignum; - is(ref(1), ""); + note "no bigfloat;"; + no bigfloat; + is(ref(hex("1")), "", 'ref(hex("1"))'); + is(ref(oct("1")), "", 'ref(oct("1"))'); } - is(ref(1), "Math::BigInt"); + is(ref(hex("1")), "Math::BigInt", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigInt", 'ref(oct("1"))'); note "no bigint;"; no bigint; - is(ref(1), ""); + is(ref(hex("1")), "", 'ref(hex("1"))'); + is(ref(oct("1")), "", 'ref(oct("1"))'); } -note "\nbigint -> bigrat -> bignum\n\n"; +note "\nbigint -> bigrat -> bigfloat\n\n"; { note "use bigint;"; use bigint; - is(ref(1), "Math::BigInt"); + is(ref(hex("1")), "Math::BigInt", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigInt", 'ref(oct("1"))'); { note "use bigrat;"; use bigrat; - is(ref(1), "Math::BigRat"); + is(ref(hex("1")), "Math::BigRat", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigRat", 'ref(oct("1"))'); { - note "use bignum;"; - use bignum; - is(ref(1), "Math::BigFloat"); - - note "no bignum;"; - no bignum; - is(ref(1), ""); + note "use bigfloat;"; + use bigfloat; + is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); + + note "no bigfloat;"; + no bigfloat; + is(ref(hex("1")), "", 'ref(hex("1"))'); + is(ref(oct("1")), "", 'ref(oct("1"))'); } - is(ref(1), "Math::BigRat"); + is(ref(hex("1")), "Math::BigRat", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigRat", 'ref(oct("1"))'); note "no bigrat;"; no bigrat; - is(ref(1), ""); + is(ref(hex("1")), "", 'ref(hex("1"))'); + is(ref(oct("1")), "", 'ref(oct("1"))'); } - is(ref(1), "Math::BigInt"); + is(ref(hex("1")), "Math::BigInt", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigInt", 'ref(oct("1"))'); note "no bigint;"; no bigint; - is(ref(1), ""); + is(ref(hex("1")), "", 'ref(hex("1"))'); + is(ref(oct("1")), "", 'ref(oct("1"))'); } -note "\nbignum -> bigint -> bigrat\n\n"; +note "\nbigfloat -> bigint -> bigrat\n\n"; { - note "use bignum;"; - use bignum; - is(ref(1), "Math::BigFloat"); + note "use bigfloat;"; + use bigfloat; + is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); { note "use bigint;"; use bigint; - is(ref(1), "Math::BigInt"); + is(ref(hex("1")), "Math::BigInt", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigInt", 'ref(oct("1"))'); { note "use bigrat;"; use bigrat; - is(ref(1), "Math::BigRat"); + is(ref(hex("1")), "Math::BigRat", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigRat", 'ref(oct("1"))'); note "no bigrat;"; no bigrat; - is(ref(1), ""); + is(ref(hex("1")), "", 'ref(hex("1"))'); + is(ref(oct("1")), "", 'ref(oct("1"))'); } - is(ref(1), "Math::BigInt"); + is(ref(hex("1")), "Math::BigInt", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigInt", 'ref(oct("1"))'); note "no bigint;"; no bigint; - is(ref(1), ""); + is(ref(hex("1")), "", 'ref(hex("1"))'); + is(ref(oct("1")), "", 'ref(oct("1"))'); } - is(ref(1), "Math::BigFloat"); + is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); - note "no bignum;"; - no bignum; - is(ref(1), ""); + note "no bigfloat;"; + no bigfloat; + is(ref(hex("1")), "", 'ref(hex("1"))'); + is(ref(oct("1")), "", 'ref(oct("1"))'); } -note "\nbignum -> bigrat -> bigint\n\n"; +note "\nbigfloat -> bigrat -> bigint\n\n"; { - note "use bignum;"; - use bignum; - is(ref(1), "Math::BigFloat"); + note "use bigfloat;"; + use bigfloat; + is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); + is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); { note "use bigrat;"; use bigrat; - is(ref(1), "Math::BigRat"); + is(ref(hex("1")), "Math::BigRat", 'ref(hex("1"))');
View file
_service:tar_scm:bignum-0.63.tar.gz/t/scope-nested-hex-oct.t -> _service:tar_scm:bignum-0.66.tar.gz/t/scope-nested-hex-oct.t
Changed
@@ -9,7 +9,7 @@ plan tests => 96; -note "\nbigint -> bignum -> bigrat\n\n"; +note "\nbigint -> bigfloat -> bigrat\n\n"; { note "use bigint;"; @@ -18,8 +18,8 @@ is(ref(oct("1")), "Math::BigInt", 'ref(oct("1"))'); { - note "use bignum;"; - use bignum; + note "use bigfloat;"; + use bigfloat; is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); @@ -38,8 +38,8 @@ is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); - note "no bignum;"; - no bignum; + note "no bigfloat;"; + no bigfloat; is(ref(hex("1")), "", 'ref(hex("1"))'); is(ref(oct("1")), "", 'ref(oct("1"))'); } @@ -53,7 +53,7 @@ is(ref(oct("1")), "", 'ref(oct("1"))'); } -note "\nbigint -> bigrat -> bignum\n\n"; +note "\nbigint -> bigrat -> bigfloat\n\n"; { note "use bigint;"; @@ -68,13 +68,13 @@ is(ref(oct("1")), "Math::BigRat", 'ref(oct("1"))'); { - note "use bignum;"; - use bignum; + note "use bigfloat;"; + use bigfloat; is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); - note "no bignum;"; - no bignum; + note "no bigfloat;"; + no bigfloat; is(ref(hex("1")), "", 'ref(hex("1"))'); is(ref(oct("1")), "", 'ref(oct("1"))'); } @@ -97,11 +97,11 @@ is(ref(oct("1")), "", 'ref(oct("1"))'); } -note "\nbignum -> bigint -> bigrat\n\n"; +note "\nbigfloat -> bigint -> bigrat\n\n"; { - note "use bignum;"; - use bignum; + note "use bigfloat;"; + use bigfloat; is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); @@ -135,17 +135,17 @@ is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); - note "no bignum;"; - no bignum; + note "no bigfloat;"; + no bigfloat; is(ref(hex("1")), "", 'ref(hex("1"))'); is(ref(oct("1")), "", 'ref(oct("1"))'); } -note "\nbignum -> bigrat -> bigint\n\n"; +note "\nbigfloat -> bigrat -> bigint\n\n"; { - note "use bignum;"; - use bignum; + note "use bigfloat;"; + use bigfloat; is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); @@ -179,13 +179,13 @@ is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); - note "no bignum;"; - no bignum; + note "no bigfloat;"; + no bigfloat; is(ref(hex("1")), "", 'ref(hex("1"))'); is(ref(oct("1")), "", 'ref(oct("1"))'); } -note "\nbigrat -> bigint -> bignum\n\n"; +note "\nbigrat -> bigint -> bigfloat\n\n"; { note "use bigrat;"; @@ -200,13 +200,13 @@ is(ref(oct("1")), "Math::BigInt", 'ref(oct("1"))'); { - note "use bignum;"; - use bignum; + note "use bigfloat;"; + use bigfloat; is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); - note "no bignum;"; - no bignum; + note "no bigfloat;"; + no bigfloat; is(ref(hex("1")), "", 'ref(hex("1"))'); is(ref(oct("1")), "", 'ref(oct("1"))'); } @@ -229,7 +229,7 @@ is(ref(oct("1")), "", 'ref(oct("1"))'); } -note "\nbigrat -> bignum -> bigint\n\n"; +note "\nbigrat -> bigfloat -> bigint\n\n"; { note "use bigrat;"; @@ -238,8 +238,8 @@ is(ref(oct("1")), "Math::BigRat", 'ref(oct("1"))'); { - note "use bignum;"; - use bignum; + note "use bigfloat;"; + use bigfloat; is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); @@ -258,8 +258,8 @@ is(ref(hex("1")), "Math::BigFloat", 'ref(hex("1"))'); is(ref(oct("1")), "Math::BigFloat", 'ref(oct("1"))'); - note "no bignum;"; - no bignum; + note "no bigfloat;"; + no bigfloat; is(ref(hex("1")), "", 'ref(hex("1"))'); is(ref(oct("1")), "", 'ref(oct("1"))'); }
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2