Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-Math-BigInt for openSUSE:Factory checked in at 2023-07-27 16:52:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Math-BigInt (Old) and /work/SRC/openSUSE:Factory/.perl-Math-BigInt.new.32662 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Math-BigInt" Thu Jul 27 16:52:00 2023 rev:46 rq:1100905 version:1.999839 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Math-BigInt/perl-Math-BigInt.changes 2023-04-03 17:47:37.066902384 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Math-BigInt.new.32662/perl-Math-BigInt.changes 2023-07-27 16:52:24.390355995 +0200 @@ -1,0 +2,14 @@ +Sat Jul 15 03:08:21 UTC 2023 - Tina Müller <timueller+p...@suse.de> + +- updated to 1.999839 + see /usr/share/doc/packages/perl-Math-BigInt/CHANGES + + 1.999839 2023-07-14 + + * Update documentation. Remove/update obsolete URLs. + + * Fix CPAN RT #148953 regarding loss of precision when using "log" in + "bignum". The issue was related to broken upgrading and downgrading in + Math::BigFloat. + +------------------------------------------------------------------- Old: ---- Math-BigInt-1.999838.tar.gz New: ---- Math-BigInt-1.999839.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Math-BigInt.spec ++++++ --- /var/tmp/diff_new_pack.HuoAKd/_old 2023-07-27 16:52:24.974359295 +0200 +++ /var/tmp/diff_new_pack.HuoAKd/_new 2023-07-27 16:52:24.982359340 +0200 @@ -18,7 +18,7 @@ %define cpan_name Math-BigInt Name: perl-Math-BigInt -Version: 1.999838 +Version: 1.999839 Release: 0 License: Artistic-1.0 OR GPL-1.0-or-later Summary: Arbitrary size integer math package @@ -34,6 +34,11 @@ BuildRequires: perl(Test::More) >= 0.94 Requires: perl(Carp) >= 1.22 Requires: perl(Math::Complex) >= 1.36 +Provides: perl(Math::BigFloat) = 1.999839 +Provides: perl(Math::BigInt) = 1.999839 +Provides: perl(Math::BigInt::Calc) = 1.999839 +Provides: perl(Math::BigInt::Lib) = 1.999839 +%define __perllib_provides /bin/true %{perl_requires} # MANUAL BEGIN Recommends: perl(bignum) >= 0.22 ++++++ Math-BigInt-1.999838.tar.gz -> Math-BigInt-1.999839.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/CHANGES new/Math-BigInt-1.999839/CHANGES --- old/Math-BigInt-1.999838/CHANGES 2023-03-31 14:30:21.000000000 +0200 +++ new/Math-BigInt-1.999839/CHANGES 2023-07-14 14:45:47.000000000 +0200 @@ -1,3 +1,11 @@ +1.999839 2023-07-14 + + * Update documentation. Remove/update obsolete URLs. + + * Fix CPAN RT #148953 regarding loss of precision when using "log" in + "bignum". The issue was related to broken upgrading and downgrading in + Math::BigFloat. + 1.999838 2023-03-30 * Fix CPAN RT #146411 regarding infinite recursion in bitwise operations. This diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/MANIFEST new/Math-BigInt-1.999839/MANIFEST --- old/Math-BigInt-1.999838/MANIFEST 2023-03-31 16:17:21.000000000 +0200 +++ new/Math-BigInt-1.999839/MANIFEST 2023-07-14 16:09:01.000000000 +0200 @@ -23,6 +23,7 @@ t/bare_mbf.t t/bare_mbi.t t/bare_mif.t +t/bfround_numify.t t/big_pi_e.t t/bigfltpm.inc t/bigfltpm.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/MANIFEST.SKIP new/Math-BigInt-1.999839/MANIFEST.SKIP --- old/Math-BigInt-1.999838/MANIFEST.SKIP 2022-10-02 13:58:45.000000000 +0200 +++ new/Math-BigInt-1.999839/MANIFEST.SKIP 2023-07-14 14:35:06.000000000 +0200 @@ -1,4 +1,4 @@ -# Start included MANIFEST.SKIP template from ExtUtils::Manifest 1.73 +# Start included MANIFEST.SKIP template from ExtUtils::Manifest 1.75 # Avoid version control files. \bRCS\b @@ -11,6 +11,8 @@ \B\.gitignore\b \b_darcs\b \B\.cvsignore$ +\B\.bzr\b +\B\.bzrignore$ # Avoid VMS specific MakeMaker generated files \bDescrip.MMS$ @@ -48,6 +50,7 @@ \.# \.rej$ \..*\.sw.?$ +\.~\d+~$ # Avoid OS-specific files/dirs # Mac OSX metadata @@ -76,7 +79,7 @@ # Avoid AppVeyor file ^\.?appveyor.yml -# End included /usr/local/share/perl5/site_perl/5.32/ExtUtils/MANIFEST.SKIP +# End included /usr/local/lib/perl5/ExtUtils/MANIFEST.SKIP # Avoid more git stuff. \B\.gitattributes\b diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/META.json new/Math-BigInt-1.999839/META.json --- old/Math-BigInt-1.999838/META.json 2023-03-31 16:17:18.000000000 +0200 +++ new/Math-BigInt-1.999839/META.json 2023-07-14 16:08:58.000000000 +0200 @@ -50,6 +50,6 @@ "web" : "https://github.com/pjacklam/p5-Math-BigInt" } }, - "version" : "1.999838", + "version" : "1.999839", "x_serialization_backend" : "JSON::PP version 4.16" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/META.yml new/Math-BigInt-1.999839/META.yml --- old/Math-BigInt-1.999838/META.yml 2023-03-31 16:17:14.000000000 +0200 +++ new/Math-BigInt-1.999839/META.yml 2023-07-14 16:08:55.000000000 +0200 @@ -24,5 +24,5 @@ perl: '5.006001' resources: repository: https://github.com/pjacklam/p5-Math-BigInt.git -version: '1.999838' +version: '1.999839' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/README new/Math-BigInt-1.999839/README --- old/Math-BigInt-1.999838/README 2022-07-03 19:50:01.000000000 +0200 +++ new/Math-BigInt-1.999839/README 2023-07-14 14:35:06.000000000 +0200 @@ -16,7 +16,7 @@ SUPPORT AND DOCUMENTATION After installing, you can find documentation for these modules with the -perldoc command. +perldoc command: perldoc Math::BigInt perldoc Math::BigFloat @@ -29,7 +29,7 @@ You can also look for information at: - GitHub + GitHub Source Repository https://github.com/pjacklam/p5-Math-BigInt RT: CPAN's request tracker @@ -41,20 +41,6 @@ CPAN Testers Matrix http://matrix.cpantesters.org/?dist=Math-BigInt - CPAN Ratings - https://cpanratings.perl.org/dist/Math-BigInt - - The Bignum mailing list - - Post to mailing list - "bignum at lists.scsys.co.uk" - - View mailing list - http://lists.scsys.co.uk/pipermail/bignum/ - - Subscribe/Unsubscribe - http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/bignum - COPYRIGHT AND LICENCE Copyright 1996-2001 Mark Biggar, Ilya Zakharevich. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/README.md new/Math-BigInt-1.999839/README.md --- old/Math-BigInt-1.999838/README.md 2022-07-03 19:50:01.000000000 +0200 +++ new/Math-BigInt-1.999839/README.md 2023-07-14 14:35:06.000000000 +0200 @@ -16,14 +16,16 @@ # SUPPORT AND DOCUMENTATION After installing, you can find documentation for these modules with the -perldoc command. +perldoc command: perldoc Math::BigInt perldoc Math::BigFloat -You can find documentation for this module with the perldoc command. +You can find documentation for the backend libraries with the following +commands: - perldoc Math::BigInt + perldoc Math::BigInt::Lib + perldoc Math::BigInt::Calc You can also look for information at: @@ -43,23 +45,6 @@ [http://matrix.cpantesters.org/?dist=Math-BigInt](http://matrix.cpantesters.org/?dist=Math-BigInt) -- CPAN Ratings - - [https://cpanratings.perl.org/dist/Math-BigInt](https://cpanratings.perl.org/dist/Math-BigInt) - -- The Bignum mailing list - - Post to mailing list - - `bignum at lists.scsys.co.uk` - - - View mailing list - - [http://lists.scsys.co.uk/pipermail/bignum/](http://lists.scsys.co.uk/pipermail/bignum/) - - - Subscribe/Unsubscribe - - [http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/bignum](http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/bignum) - # COPYRIGHT Copyright 1996-2001 Mark Biggar, Ilya Zakharevich. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/SIGNATURE new/Math-BigInt-1.999839/SIGNATURE --- old/Math-BigInt-1.999838/SIGNATURE 2023-03-31 16:17:27.000000000 +0200 +++ new/Math-BigInt-1.999839/SIGNATURE 2023-07-14 16:09:05.000000000 +0200 @@ -15,27 +15,27 @@ Hash: RIPEMD160 SHA256 961f8c23b6fc94cb9766265257dd548b190087df0c71dfd7d994bc649af5f002 BUGS -SHA256 9b432465325ff89dc74a6149b45f99c76a4184d4cf8220ca67a0eb8205c7d711 CHANGES +SHA256 9529715a4af906acefec7d8ae2733d17401ac810f5cb3c176878b902efa459ca CHANGES SHA256 7d84c6e69ee6c3ab6301314d2fa4bc233f24bd36a4a546b2cfd05a078bda98b7 CREDITS SHA256 fd8f78318c23adef95971cc01ee0e79d68f52f60b761ba28129c8509fff46954 GOALS SHA256 28e80ee628ff111dd34a2a26af921693c9c823caadab30c848e4c4f4fc00830f HISTORY SHA256 b857edab549ac6893e2df5e1ec768ee46b62bcf1607a55e876f4d23f079eacce LICENSE -SHA256 eff8d9db8aa0fe02bc74643e8fdea5aaf423cd885e67d1d046526b903d4397b8 MANIFEST -SHA256 6cbc650165422bed661f292abb91ffaefa416830203a2aa8c790114ce6535cde MANIFEST.SKIP -SHA256 a1dc6acf784a5a6bb73f6b8ac1dfc6fcd83fbb55c9f8f5e0f035b82511d4f42c META.json -SHA256 035d8a88fbc630bb729ecb63df5c6ca99d9fc3db8ee7b70627070e73e04b690f META.yml +SHA256 fc659cba8c9bbd654c8c7d5e72285e0fde214c5dc46b7dd5eced74a4f1690094 MANIFEST +SHA256 01b3b7d95e172c142f6e56c8edd636cf7e0bea6511ead13900393d21740e3d19 MANIFEST.SKIP +SHA256 918557eab2eead1ddde5c7d7c8e12cfcb8249bb9d921a71908ca8a39c6d20bff META.json +SHA256 37e326479d8caacd082ce41c96ed3247ca432e9d2ae2b4af486ac8d16182e692 META.yml SHA256 053b2511fa5ac8e6141b5596d6777220ef257a5ddfda3f3ff7325907757660a7 Makefile.PL SHA256 99f7f7df45a00c9f19ad38edec8c5dad5f5977c2b1a14ac3bb491ac193db1f7d NEW -SHA256 2aadb8383836311d8b47a34b7eb1c68043ccd5b90bfc2d9c57016b33579d2385 README -SHA256 840a73836543a3b0dce81fbcf8cb4fa080b9f5e1144bd17325418dae5a6b910c README.md +SHA256 37c71b4b6d6c40c46b31e5e18a64b234790d78803474f25d4c1ede476ff1c287 README +SHA256 4fb9762e4ad85ef7a708464a3f5ffc3a10db12026806af303de26561db6e10d1 README.md SHA256 546b67064f9314ed19382b6677bcbe699e774f5edcc31e6dc9567a2e54998eff TODO SHA256 77a80748e329a042faaa91eb0b44a493dfdfd726fec854a1a376c8404324b485 examples/1000.txt SHA256 702e323f59be58db758a3fa70ffe5fb80d392043bb855b0f172dd748809435df examples/bigprimes.pl SHA256 81a3ff3476038ec839c12a2b3548898055112bebc81fbf3513ee5efd6adfd0bd examples/prime.pl -SHA256 2d8b8439445754dff1ec3871279b20fb807944d59b13e962e3beb5d99e8077fc lib/Math/BigFloat.pm -SHA256 eadf4ebf7e263b816676b3b83625b4ac6622cab3e6270cd738e4dee12864f0bc lib/Math/BigInt.pm -SHA256 0a5031476e2e649e9fb2bbeaf8bb1296bcc1a9f37a8b3389967bca793da76fbb lib/Math/BigInt/Calc.pm -SHA256 31c7eb01a7517a96acadcffa0001ee0340c492384b390c3c90f9ba1cfd188172 lib/Math/BigInt/Lib.pm +SHA256 fe2c693c3a6ad880d8ad4356470c22213aa9ef997aa266f53d73961f537f8758 lib/Math/BigFloat.pm +SHA256 b8d52b93c54904b19444df35a5fe26048cb5fd2c93cac99e5983c337f3d09ef0 lib/Math/BigInt.pm +SHA256 e3eb34c41127fa5a07e82a9a2c93a852260458a5acf63458df7a284306556669 lib/Math/BigInt/Calc.pm +SHA256 4e91211b4c0f18d15514e588fc81b0b6bbe66b56d1b29e9c6cb752e4df79e1d2 lib/Math/BigInt/Lib.pm SHA256 f855e68d0f171debf8369ead8b36d004188f1c9069287a0d3c67a87f9afb1312 t/00sig.t SHA256 64c07f96b6a1d6adb075f40bf2dc496fd7951b653458bd9f826e4f76f8e5423d t/01load.t SHA256 a756e0bc9a221303e562d0f25969965962e6121605ee9bb0ee3cb54e69dd2222 t/Math/BigFloat/Subclass.pm @@ -48,6 +48,7 @@ SHA256 047ca70d1848c1dbb96cc833883cf49e2172c5113d1c6fbf9eb0e73d0cb3c94e t/bare_mbf.t SHA256 1e3a5c5a59bc86250de8a6f8459b16a86e66e09f55579e869bf38f5436520af4 t/bare_mbi.t SHA256 529b262c435496677cacbaf88170621ce2db3311592925651f8c6ea613df350e t/bare_mif.t +SHA256 a1861954ec5e5713386422c4348a8c33fa1b156535b0d8b93385805aa8fc6583 t/bfround_numify.t SHA256 0fd211be28a75344168544dbe0bdab2ff79d8616d11691a3faeba0aa2f971cc0 t/big_pi_e.t SHA256 b5f6aacf13dc567671170a4086a03c43143af31b3596542e521464c5db19bba1 t/bigfltpm.inc SHA256 2e2e28dde05851db40b820056709971c75fd211857befa4c56402fc646009c0f t/bigfltpm.t @@ -342,11 +343,11 @@ SHA256 7aa223732dec88d581e015ac171308b256a9d061ea3c832ad4f7048266226e97 xt/release/whitespaces.t -----BEGIN PGP SIGNATURE----- -iQEcBAEBAwAGBQJkJut0AAoJEGcmPl2fr166mmUH/ArOOsdbdiv0BpsfCNRnujat -1j3/ZbdPquZeQfrhhTv19S/OnvEJfMNQC23hfONlKYwP++n8uTbaQb6m8++IMEbV -9C2SUIbqBiNqEI32c8+e0+1u8tfqKmF5DQXrrCzpF3+vsJ7BOGayVNGtW5Bl4wY0 -QZq+U4n4NUlWAqsQYMQGgoYNjo9tdxcS2xAP0JK+JjrUEeySuTNWtNKkuxSak8LR -CL4lQtGsbOngJ5VaCK5RTEDA+Ly+OO/Y7ulQWenfV13JgoMULXZIehP896fAiydc -YOi4uxPsamP+TgVU9rXlT4GL56QmVMtjVVTCrKrLIb/55BXymckBGDMByPd2e+k= -=lbuf +iQEcBAEBAwAGBQJksVb/AAoJEGcmPl2fr166Jt8H/AyfalFfbflAvxT+vQ0S3nEI +5ELpJMVyMru1vJlUaTwN9+OCPZwfjj7DKnVxAlhHf0luG2YyIkUTbmdhL4I586eQ +l835a6BBboUGqlQP9LRJPNbzw1Tb+fWWUWMOQjCYP6GG+6mvzWZeiLKvamWfkae9 +gfbtdBk3oFxYJzbBSf3KqKOiCBiXmt6PQcqNxZNZD01hWWfo+GEl6Xfqi/FsZD0Y +vMyB8ZQSF9e4uyY8wTddpVcsJfStEXKaZ4O2R3KhTzc+1P2JvniuonvTs9caPn+C +IAzbetGelFVfAv0o9wzhGxFmosGY+TmzZ5j5jaMP3V2cYNVuaheSvBVz50ehrak= +=Uhps -----END PGP SIGNATURE----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/lib/Math/BigFloat.pm new/Math-BigInt-1.999839/lib/Math/BigFloat.pm --- old/Math-BigInt-1.999838/lib/Math/BigFloat.pm 2023-03-31 13:30:02.000000000 +0200 +++ new/Math-BigInt-1.999839/lib/Math/BigFloat.pm 2023-07-14 15:00:07.000000000 +0200 @@ -20,7 +20,7 @@ use Scalar::Util qw< blessed >; use Math::BigInt qw< >; -our $VERSION = '1.999838'; +our $VERSION = '1.999839'; $VERSION =~ tr/_//d; require Exporter; @@ -2475,24 +2475,56 @@ my ($class, $x, $base, @r); # Only objectify the base if it is defined, since an undefined base, as in - # $x->blog() or $x->blog(undef) signals that the base is Euler's number. + # $x->blog() or $x->blog(undef) signals that the base is Euler's number = + # 2.718281828... if (!ref($_[0]) && $_[0] =~ /^[A-Za-z]|::/) { # E.g., Math::BigFloat->blog(256, 2) ($class, $x, $base, @r) = defined $_[2] ? objectify(2, @_) : objectify(1, @_); } else { - # E.g., Math::BigFloat::blog(256, 2) or $x->blog(2) + # E.g., $x->blog(2) or the deprecated Math::BigFloat::blog(256, 2) ($class, $x, $base, @r) = defined $_[1] ? objectify(2, @_) : objectify(1, @_); } return $x if $x->modify('blog'); + # Handle all exception cases and all trivial cases. I have used Wolfram + # Alpha (http://www.wolframalpha.com) as the reference for these cases. + return $x -> bnan(@r) if $x -> is_nan(); - return $upgrade -> blog($x, $base, @r) - if defined($upgrade) && $x -> is_neg(); + if (defined $base) { + $base = $class -> new($base) + unless defined(blessed($base)) && $base -> isa($class); + if ($base -> is_nan() || $base -> is_one()) { + return $x -> bnan(@r); + } elsif ($base -> is_inf() || $base -> is_zero()) { + return $x -> bnan(@r) if $x -> is_inf() || $x -> is_zero(); + return $x -> bzero(@r); + } elsif ($base -> is_negative()) { # -inf < base < 0 + return $x -> bzero(@r) if $x -> is_one(); # x = 1 + return $x -> bone('+', @r) if $x == $base; # x = base + # we can't handle these cases, so upgrade, if we can + return $upgrade -> blog($x, $base, @r) if defined $upgrade; + return $x -> bnan(@r); + } + return $x -> bone(@r) if $x == $base; # 0 < base && 0 < x < inf + } + + if ($x -> is_inf()) { # x = +/-inf + my $sign = defined($base) && $base < 1 ? '-' : '+'; + return $x -> binf($sign, @r); + } elsif ($x -> is_neg()) { # -inf < x < 0 + return $upgrade -> blog($x, $base, @r) if defined $upgrade; + return $x -> bnan(@r); + } elsif ($x -> is_one()) { # x = 1 + return $x -> bzero(@r); + } elsif ($x -> is_zero()) { # x = 0 + my $sign = defined($base) && $base < 1 ? '+' : '-'; + return $x -> binf($sign, @r); + } # we need to limit the accuracy to protect against overflow my $fallback = 0; @@ -2513,66 +2545,6 @@ $scale = abs($params[0] || $params[1]) + 4; # take whatever is defined } - my $done = 0; - if (defined $base) { - $base = $class -> new($base) - unless defined(blessed($base)) && $base -> isa($class); - if ($base -> is_nan() || $base -> is_one()) { - $x = $x -> bnan(); - $done = 1; - } elsif ($base -> is_inf() || $base -> is_zero()) { - if ($x -> is_inf() || $x -> is_zero()) { - $x = $x -> bnan(); - } else { - $x = $x -> bzero(@params); - } - $done = 1; - } elsif ($base -> is_negative()) { # -inf < base < 0 - if ($x -> is_one()) { # x = 1 - $x = $x -> bzero(@params); - } elsif ($x == $base) { - $x = $x -> bone('+', @params); # x = base - } else { - $x = $x -> bnan(); # otherwise - } - $done = 1; - } elsif ($x == $base) { - $x = $x -> bone('+', @params); # 0 < base && 0 < x < inf - $done = 1; - } - } - - # We now know that the base is either undefined or positive and finite. - - unless ($done) { - if ($x -> is_inf()) { # x = +/-inf - my $sign = defined $base && $base < 1 ? '-' : '+'; - $x = $x -> binf($sign); - $done = 1; - } elsif ($x -> is_neg()) { # -inf < x < 0 - $x = $x -> bnan(); - $done = 1; - } elsif ($x -> is_one()) { # x = 1 - $x = $x -> bzero(@params); - $done = 1; - } elsif ($x -> is_zero()) { # x = 0 - my $sign = defined $base && $base < 1 ? '+' : '-'; - $x = $x -> binf($sign); - $done = 1; - } - } - - if ($done) { - if ($fallback) { - # clear a/p after round, since user did not request it - $x->{_a} = undef; - $x->{_p} = undef; - } - return $downgrade -> new($x -> bdstr(), @r) - if defined($downgrade) && $x->is_int(); - return $x; - } - # when user set globals, they would interfere with our calculation, so # disable them and later re-enable them no strict 'refs'; @@ -2587,11 +2559,10 @@ $x->{_a} = undef; $x->{_p} = undef; - $done = 0; + my $done = 0; - # If both the invocand and the base are integers, try to calculate integer - # result first. This is very fast, and in case the real result was found, we - # can stop right here. + # If both $x and $base are integers, try to calculate an integer result + # first. This is very fast, and if the exact result was found, we are done. if (defined($base) && $base -> is_int() && $x -> is_int()) { my $x_lib = $LIB -> _new($x -> bdstr()); @@ -2605,24 +2576,25 @@ } } - unless ($done) { - - # First calculate the log to base e (using reduction by 10 and possibly - # also by 2), and if a different base was requested, convert the result. + # If the integer result was not accurate, compute the natural logarithm + # log($x) (using reduction by 10 and possibly also by 2), and if a + # different base was requested, convert the result with log($x)/log($base). - $x = $x->_log_10($scale); + unless ($done) { + $x = $x -> _log_10($scale); if (defined $base) { # log_b(x) = ln(x) / ln(b), so compute ln(b) - my $base_log_e = $base->copy()->_log_10($scale); - $x = $x->bdiv($base_log_e, $scale); + my $base_log_e = $base -> copy() -> _log_10($scale); + $x = $x -> bdiv($base_log_e, $scale); } } # shortcut to not run through _find_round_parameters again + if (defined $params[0]) { - $x = $x->bround($params[0], $params[2]); # then round accordingly + $x = $x -> bround($params[0], $params[2]); # then round accordingly } else { - $x = $x->bfround($params[1], $params[2]); # then round accordingly + $x = $x -> bfround($params[1], $params[2]); # then round accordingly } if ($fallback) { # clear a/p after round, since user did not request it @@ -2634,7 +2606,7 @@ $$pbr = $pb; return $downgrade -> new($x -> bdstr(), @r) - if defined($downgrade) && $x->is_int(); + if defined($downgrade) && $x -> is_int(); return $x; } @@ -2695,8 +2667,10 @@ # infinite recursion, but it avoids unnecessary upgrading and downgrading in # the intermediate computations. - local $Math::BigInt::upgrade = undef; - local $Math::BigFloat::downgrade = undef; + # Temporarily disable downgrading + + my $dng = Math::BigFloat -> downgrade(); + Math::BigFloat -> downgrade(undef); my $x_org = $x->copy(); @@ -2819,15 +2793,21 @@ $x = $x->bfround($params[1], $params[2]); # then round accordingly } } + if ($fallback) { # clear a/p after round, since user did not request it $x->{_a} = undef; $x->{_p} = undef; } - # restore globals + + # Restore globals $$abr = $ab; $$pbr = $pb; + # Restore downgrading. + + Math::BigFloat -> downgrade($dng); + return $downgrade -> new($x -> bdstr(), @r) if defined($downgrade) && $x -> is_int(); $x; @@ -5462,7 +5442,7 @@ my $class = ref $x; # in case of $x == 1, result is 0 - return $x->bzero() if $x->is_one(); + return $x -> bzero() if $x -> is_one(); # XXX TODO: rewrite this in a similar manner to bexp() @@ -5481,56 +5461,49 @@ # ln (x) = 2 | --- + - * --- + - * --- + ... | x > 1/2 # |_ x 2 x^2 3 x^3 _| - my ($limit, $v, $u, $below, $factor, $next, $over, $f); + # scale used in intermediate computations + my $scaleup = $scale + 4; + + my ($v, $u, $numer, $denom, $factor, $f); - $v = $x->copy(); + $v = $x -> copy(); $v = $v -> binc(); # v = x+1 - $x = $x->bdec(); - $u = $x->copy(); # u = x-1; x = x-1 - $x = $x->bdiv($v, $scale); # first term: u/v - $below = $v->copy(); - $over = $u->copy(); + $x = $x -> bdec(); + $u = $x -> copy(); # u = x-1; x = x-1 + + $x = $x -> bdiv($v, $scaleup); # first term: u/v + + $numer = $u -> copy(); # numerator + $denom = $v -> copy(); # denominator + $u = $u -> bmul($u); # u^2 $v = $v -> bmul($v); # v^2 - $below = $below->bmul($v); # u^3, v^3 - $over = $over->bmul($u); - $factor = $class->new(3); - $f = $class->new(2); - $limit = $class->new("1E-". ($scale-1)); + $numer = $numer -> bmul($u); # u^3 + $denom = $denom -> bmul($v); # v^3 - while (3 < 5) { - # we calculate the next term, and add it to the last - # when the next term is below our limit, it won't affect the outcome - # anymore, so we stop - - # calculating the next term simple from over/below will result in quite - # a time hog if the input has many digits, since over and below will - # accumulate more and more digits, and the result will also have many - # digits, but in the end it is rounded to $scale digits anyway. So if we - # round $over and $below first, we save a lot of time for the division - # (not with log(1.2345), but try log (123**123) to see what I mean. This - # can introduce a rounding error if the division result would be f.i. - # 0.1234500000001 and we round it to 5 digits it would become 0.12346, - # but if we truncated $over and $below we might get 0.12345. Does this - # matter for the end result? So we give $over and $below 4 more digits - # to be on the safe side (unscientific error handling as usual... :+D - - $next = $over->copy()->bround($scale+4) - ->bdiv($below->copy()->bmul($factor)->bround($scale+4), - $scale); + $factor = $class -> new(3); + $f = $class -> new(2); - last if $next->bacmp($limit) <= 0; + while (1) { + my $next = $numer -> copy() -> bround($scaleup) + -> bdiv($denom -> copy() -> bmul($factor) -> bround($scaleup), $scaleup); $next->{_a} = undef; $next->{_p} = undef; - $x = $x->badd($next); + my $x_prev = $x -> copy(); + $x = $x -> badd($next); + + last if $x -> bacmp($x_prev) == 0; + # calculate things for the next term - $over *= $u; - $below *= $v; - $factor = $factor->badd($f); + $numer = $numer -> bmul($u); + $denom = $denom -> bmul($v); + $factor = $factor -> badd($f); } - $x->bmul($f); # $x *= 2 + + $x = $x -> bmul($f); # $x *= 2 + $x = $x -> bround($scale); } sub _log_10 { @@ -5559,8 +5532,12 @@ # In addition, the values for blog(2) and blog(10) are cached. - # Calculate nr of digits before dot. x = 123, dbd = 3; x = 1.23, dbd = 1; - # x = 0.0123, dbd = -1; x = 0.000123, dbd = -3, etc. + # Calculate the number of digits before the dot, i.e., 1 + floor(log10(x)): + # x = 123 => dbd = 3 + # x = 1.23 => dbd = 1 + # x = 0.0123 => dbd = -1 + # x = 0.000123 => dbd = -3 + # etc. my $dbd = $LIB->_num($x->{_e}); $dbd = -$dbd if $x->{_es} eq '-'; @@ -5571,6 +5548,11 @@ my $calc = 1; # do some calculation? + # No upgrading or downgrading in the intermediate computations. + + local $Math::BigInt::upgrade = undef; + local $Math::BigFloat::downgrade = undef; + # disable the shortcut for 10, since we need log(10) and this would recurse # infinitely deep if ($x->{_es} eq '+' && # $x == 10 @@ -5631,7 +5613,6 @@ # at import() time, since not everybody needs this) $LOG_10 = $class->new($LOG_10, undef, undef) unless ref $LOG_10; - #print "x = $x, dbd = $dbd, calc = $calc\n"; # got more than one digit before the dot, or more than one zero after # the dot, so do: # log(123) == log(1.23) + log(10) * 2 @@ -5643,13 +5624,6 @@ } else { # else: slower, compute and cache result - # Disabling upgrading and downgrading is no longer necessary to - # avoid an infinite recursion, but it avoids unnecessary upgrading - # and downgrading in the intermediate computations. - - local $Math::BigInt::upgrade = undef; - local $Math::BigFloat::downgrade = undef; - # shorten the time to calculate log(10) based on the following: # log(1.25 * 8) = log(1.25) + log(8) # = log(1.25) + log(2) + log(2) + log(2) @@ -5717,14 +5691,6 @@ $l_2 = $LOG_2->copy(); # copy() for the mul below } else { # else: slower, compute and cache result - - # Disabling upgrading and downgrading is no longer necessary to - # avoid an infinite recursion, but it avoids unnecessary upgrading - # and downgrading in the intermediate computations. - - local $Math::BigInt::upgrade = undef; - local $Math::BigFloat::downgrade = undef; - $l_2 = $two->copy(); $l_2 = $l_2->_log($scale); # scale+4, actually $LOG_2 = $l_2->copy(); # cache the result for later @@ -6773,28 +6739,6 @@ L<http://matrix.cpantesters.org/?dist=Math-BigInt> -=item * CPAN Ratings - -L<https://cpanratings.perl.org/dist/Math-BigInt> - -=item * The Bignum mailing list - -=over 4 - -=item * Post to mailing list - -C<bignum at lists.scsys.co.uk> - -=item * View mailing list - -L<http://lists.scsys.co.uk/pipermail/bignum/> - -=item * Subscribe/Unsubscribe - -L<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/bignum> - -=back - =back =head1 LICENSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/lib/Math/BigInt/Calc.pm new/Math-BigInt-1.999839/lib/Math/BigInt/Calc.pm --- old/Math-BigInt-1.999838/lib/Math/BigInt/Calc.pm 2022-07-05 15:52:58.000000000 +0200 +++ new/Math-BigInt-1.999839/lib/Math/BigInt/Calc.pm 2023-07-14 14:35:06.000000000 +0200 @@ -7,7 +7,7 @@ use Carp qw< carp croak >; use Math::BigInt::Lib; -our $VERSION = '1.999838'; +our $VERSION = '1.999839'; $VERSION =~ tr/_//d; our @ISA = ('Math::BigInt::Lib'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/lib/Math/BigInt/Lib.pm new/Math-BigInt-1.999839/lib/Math/BigInt/Lib.pm --- old/Math-BigInt-1.999838/lib/Math/BigInt/Lib.pm 2022-07-05 15:52:58.000000000 +0200 +++ new/Math-BigInt-1.999839/lib/Math/BigInt/Lib.pm 2023-07-14 14:35:33.000000000 +0200 @@ -4,7 +4,7 @@ use strict; use warnings; -our $VERSION = '1.999838'; +our $VERSION = '1.999839'; $VERSION =~ tr/_//d; use Carp; @@ -2585,17 +2585,13 @@ =over 4 -=item * RT: CPAN's request tracker - -L<https://rt.cpan.org/Public/Dist/Display.html?Name=Math-BigInt> +=item * GitHub Source Repository -=item * AnnoCPAN: Annotated CPAN documentation +L<https://github.com/pjacklam/p5-Math-BigInt> -L<http://annocpan.org/dist/Math-BigInt> - -=item * CPAN Ratings +=item * RT: CPAN's request tracker -L<https://cpanratings.perl.org/dist/Math-BigInt> +L<https://rt.cpan.org/Public/Dist/Display.html?Name=Math-BigInt> =item * MetaCPAN @@ -2605,24 +2601,6 @@ L<http://matrix.cpantesters.org/?dist=Math-BigInt> -=item * The Bignum mailing list - -=over 4 - -=item * Post to mailing list - -C<bignum at lists.scsys.co.uk> - -=item * View mailing list - -L<http://lists.scsys.co.uk/pipermail/bignum/> - -=item * Subscribe/Unsubscribe - -L<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/bignum> - -=back - =back =head1 LICENSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/lib/Math/BigInt.pm new/Math-BigInt-1.999839/lib/Math/BigInt.pm --- old/Math-BigInt-1.999838/lib/Math/BigInt.pm 2023-03-31 13:30:02.000000000 +0200 +++ new/Math-BigInt-1.999839/lib/Math/BigInt.pm 2023-07-14 14:39:27.000000000 +0200 @@ -23,7 +23,7 @@ use Carp qw< carp croak >; use Scalar::Util qw< blessed refaddr >; -our $VERSION = '1.999838'; +our $VERSION = '1.999839'; $VERSION =~ tr/_//d; require Exporter; @@ -2701,10 +2701,11 @@ my ($class, $x, $base, @r); - # Don't objectify the base, since an undefined base, as in $x->blog() or - # $x->blog(undef) signals that the base is Euler's number. + # Only objectify the base if it is defined, since an undefined base, as in + # $x->blog() or $x->blog(undef) signals that the base is Euler's number = + # 2.718281828... - if (!ref($_[0]) && $_[0] =~ /^[a-z]\w*(?:::[a-z]\w*)*$/i) { + if (!ref($_[0]) && $_[0] =~ /^[a-z]\w*(?:::\w+)*$/i) { # E.g., Math::BigInt->blog(256, 2) ($class, $x, $base, @r) = defined $_[2] ? objectify(2, @_) : objectify(1, @_); @@ -2722,7 +2723,8 @@ return $x -> bnan(@r) if $x -> is_nan(); if (defined $base) { - $base = $class -> new($base) unless ref $base; + $base = $class -> new($base) + unless defined(blessed($base)) && $base -> isa($class); if ($base -> is_nan() || $base -> is_one()) { return $x -> bnan(@r); } elsif ($base -> is_inf() || $base -> is_zero()) { @@ -2730,18 +2732,26 @@ return $x -> bzero(@r); } elsif ($base -> is_negative()) { # -inf < base < 0 return $x -> bzero(@r) if $x -> is_one(); # x = 1 - return $x -> bone(@r) if $x == $base; # x = base - return $x -> bnan(@r); # otherwise + return $x -> bone('+', @r) if $x == $base; # x = base + # we can't handle these cases, so upgrade, if we can + return $upgrade -> blog($x, $base, @r) if defined $upgrade; + return $x -> bnan(@r); } return $x -> bone(@r) if $x == $base; # 0 < base && 0 < x < inf } # We now know that the base is either undefined or >= 2 and finite. - return $x -> binf('+', @r) if $x -> is_inf(); # x = +/-inf - return $x -> bnan(@r) if $x -> is_neg(); # -inf < x < 0 - return $x -> bzero(@r) if $x -> is_one(); # x = 1 - return $x -> binf('-', @r) if $x -> is_zero(); # x = 0 + if ($x -> is_inf()) { # x = +/-inf + return $x -> binf('+', @r); + } elsif ($x -> is_neg()) { # -inf < x < 0 + return $upgrade -> blog($x, $base, @r) if defined $upgrade; + return $x -> bnan(@r); + } elsif ($x -> is_one()) { # x = 1 + return $x -> bzero(@r); + } elsif ($x -> is_zero()) { # x = 0 + return $x -> binf('-', @r); + } # At this point we are done handling all exception cases and trivial cases. @@ -2751,15 +2761,31 @@ # the default base is e (Euler's number) which is not an integer if (!defined $base) { require Math::BigFloat; - my $u = Math::BigFloat->blog($x)->as_int(); + + # disable upgrading and downgrading + + my $upg = Math::BigFloat -> upgrade(); + my $dng = Math::BigFloat -> downgrade(); + Math::BigFloat -> upgrade(undef); + Math::BigFloat -> downgrade(undef); + + my $u = Math::BigFloat -> blog($x) -> as_int(); + + # reset upgrading and downgrading + + Math::BigFloat -> upgrade($upg); + Math::BigFloat -> downgrade($dng); + # modify $x in place + $x->{value} = $u->{value}; - $x->{sign} = $u->{sign}; + $x->{sign} = $u->{sign}; + return $x -> round(@r); } - my ($rc) = $LIB->_log_int($x->{value}, $base->{value}); - return $x->bnan(@r) unless defined $rc; # not possible to take log? + my ($rc) = $LIB -> _log_int($x->{value}, $base->{value}); + return $x -> bnan(@r) unless defined $rc; # not possible to take log? $x->{value} = $rc; $x = $x -> round(@r); } @@ -8547,28 +8573,6 @@ L<http://matrix.cpantesters.org/?dist=Math-BigInt> -=item * CPAN Ratings - -L<https://cpanratings.perl.org/dist/Math-BigInt> - -=item * The Bignum mailing list - -=over 4 - -=item * Post to mailing list - -C<bignum at lists.scsys.co.uk> - -=item * View mailing list - -L<http://lists.scsys.co.uk/pipermail/bignum/> - -=item * Subscribe/Unsubscribe - -L<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/bignum> - -=back - =back =head1 LICENSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Math-BigInt-1.999838/t/bfround_numify.t new/Math-BigInt-1.999839/t/bfround_numify.t --- old/Math-BigInt-1.999838/t/bfround_numify.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Math-BigInt-1.999839/t/bfround_numify.t 2023-07-14 14:35:06.000000000 +0200 @@ -0,0 +1,17 @@ +use strict; +use warnings; + +use Test::More tests => 3; + +use Math::BigFloat; + +my $mbf = 'Math::BigFloat'; + +my $x = $mbf->new('123456.123456'); + +is($x->numify, 123456.123456, 'numify before bfround'); + +$x->bfround(-2); + +is($x->numify, 123456.12, 'numify after bfround'); +is($x->bstr, "123456.12", 'bstr after bfround');