| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since bfloor() and bceil() exist, add bint() for completeness. As with
bfloor() and bceil(), bint() does not change the object class. This is
unlike as_int(), which converts the object to a Math::BigInt.
Rename bint() subroutine in the example section to bigint() to avoid
confusion with the new method bint().
Add tests for bint().
Add a little more precise documentation of bfloor() and bceil().
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Based on work done by Peter John Acklam, differences from his original
patch:
- links to items (which have been corrected by others) have been retained
- unnecessary conversion of < and > to E<lt> and E<gt> has been skipped.
- =over N has been converted to =over
- adjusted white-space in many places to avoid hitting column 80 in
perldoc for verbatim text
|
| |
|
| |
|
| |
|
|
|
|
|
| |
These were all uncovered by the new Pod::Checker, not yet in core.
Fixing these will speed up debugging the new Checker.
|
| |
|
|
|
|
| |
BigInt.pm intentionally registered an unregisterable op.
|
|
|
|
|
| |
- For simplicity, use same version number 1.997 in all .pm files to match the
upcoming release 1.997 of the Math-BigInt distribution.
|
|
|
|
|
| |
This stops Pod::Coverage (and possibly users)
from complaining about missing documentation.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
I started to make Math::BigInt’s pod fit within 79 columns, but
soon petered out. At least this is better than nothing.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Math::BigFloat->numify() shall, according to the documentation and to be
consistent with Math::BigInt->numify() and Math::BigRat->numify(),
return a Perl scalar number, not a string.
- dist/Math-BigInt/lib/Math/BigFloat.pm:
- Fix objectify().
- dist/Math-BigInt/t/bigfltpm.inc:
- Remove no longer relevant tests.
- Modify existing tests and add new tests to verify correct behaviour.
This fix closes RT #66732.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Fix handling of "foreign objects" so they are converted to the
appropriate class (Math::BigInt or Math::BigFloat).
- Avoid code duplication by using only one loop.
- Loop over indexes rather than array elements to make code cleaner.
- Fix incorrect code comments, add more code comments and clearify
existing ones.
- Correct handling of undefs to make the code consistent. objectify()
gave different output when the initial "shortcut" was removed.
- Add test file verifying that RT#16221 is fixed.
This fix closes RT #16221 and RT #52124. This patch supersedes Perl #86146.
|
|
|
|
|
|
|
| |
This is the standard mathematical signum function. It sets the
invocand to -1, 0, or 1, if it is real, and NaN otherwise.
Documentation and tests are included.
|
|
|
|
| |
There is a 1.993 release on CPAN. There have been more changes since.
|
|
|
|
|
|
|
|
|
| |
bmuladd() contains a test to avoid calling objectify() when it isn't
necessary. This test catches too much, so objectify() isn't always called
when it should have been, e.g., when the two first arguments are are
Math::BigInts and the third is something else, a Math::BigInt::Lite for
example. This causes tests in Math::BigInt::Lite to fail (RT #66369). Also
fix bmuladd() in Math::BigFloat since it suffers from the same problem.
|
|
|
|
|
|
| |
Confirm that numify() on a value that can be represented exactly as
a Perl scalar integer is not converted to a floating point number,
e.g., that it returns 18446744073709551615, not 1.84467440737096e+19.
|
|
|
|
|
| |
Add more precise documentation of the behaviour of from_oct(),
from_hex(), and from_bin().
|
|
|
|
|
|
|
|
|
|
|
| |
# New Ticket Created by (Peter J. Acklam)
# Please include the string: [perl #84844]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=84844 >
Change default backend library from Math::BigInt::FastCalc to
Math::BigInt::Calc, which is included in the Math-BigInt distro.
This avoids recursive distribution dependency (RT #65976).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
dist/Math-BigInt/lib/Math/BigFloat.pm:
- Increment version number.
dist/Math-BigInt/lib/Math/BigInt.pm:
- Increment version number.
- Make from_hex(), from_oct(), and behave more like hex() and oct()
in the Perl core, and make from_bin() consistent with from_hex()
and from_oct(). This is related to RT #58954.
dist/Math-BigInt/lib/Math/BigInt/Calc.pm:
- Increment version number.
- Make _rem() modify first input arg always, not just sometimes.
- Make _modinv() more consistent with the _modinv() method in other
libraries (Math::BigInt::GMP, etc.)
- In _nok(), use symmetry property nok(n,k) = nok(n,n-k). This cuts
computation time tremendously when n and k are large.
- In _gcd(), quickly handle zero cases, avoid code duplication, and
always modify the first input argument in-place.
- Clean up code and add more code comments.
- Fix typos.
dist/Math-BigInt/lib/Math/BigInt/CalcEmu.pm:
- Increment version number.
dist/Math-BigInt/t/bigintpm.inc:
- Modify tests to something that still fails.
dist/Math-BigInt/t/upgrade.inc:
- Modify tests to something that still fails.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- dist/Math-BigInt/lib/Math/BigFloat.pm: Increment version number.
- dist/Math-BigInt/lib/Math/BigInt.pm: Add workaround for library
inconsistencies (Math::BigInt::Calc vs. Math::BigInt::GMP). This makes
older versions of Math::BigInt::GMP work with latest version of
Math::BigInt.
- dist/Math-BigInt/lib/Math/BigInt/Calc.pm: Correct and extend API
documentation. Increment version number.
- dist/Math-BigInt/lib/Math/BigInt/CalcEmu.pm: Increment version number.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This bug is not seen when the libraries Calc and FastCalc are used,
because their _modpow() method modifies the first argument. However,
the GMP library's _modpow() does not modify the first argument,
causing a so far undetected bug to show up and fail tests.
Using the Calc library prints the correct "-4":
use Math::BigInt lib => Calc;
$x = Math::BigInt->new(8);
$y = Math::BigInt->new(8);
$z = Math::BigInt->new(-5);
print $x -> bmodpow($y, $z), "\n";
Using the GMP library prints the incorrect "--":
use Math::BigInt lib => GMP;
$x = Math::BigInt->new(8);
$y = Math::BigInt->new(8);
$z = Math::BigInt->new(-5);
print $x -> bmodpow($y, $z), "\n";
|
|
|
|
|
|
| |
Some whitespace is being interpreted as "not a blank line" causing it (and
possibly other parsers) to assume that subsequent text is part of the preceding
=head or =item
|
|
|
|
| |
release per cmpVERSION.pl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Extend bmodpow() to handle negative numbers.
- dist/Math-BigInt/lib/Math/BigInt.pm: Fix bmodpow() code and make the
documentation style more like that of other methods.
- dist/Math-BigInt/t/bigintpm.inc: Edit test results so they match new
behaviour, i.e., where earlier a NaN was returned, there are now
some cases where an integer is returned, since bmodpow() now also
handles negative numbers. Also include test cases from RT 63237. The
tests themselves have all been verified to be correct using other
software.
- dist/Math-BigRat/t/bigratpm.inc: Fix test case so it matches the new
behaviour of Math::BigInt->bmodinv(). Math::BigRat->bmodinv() only
handles integers, and is essentially just a front-end to
Math::BigInt->bmodinv().
- dist/Math-BigInt/t/bare_mbi.t: Increment test count.
- dist/Math-BigInt/t/bigintpm.t: Increment test count.
- dist/Math-BigInt/t/sub_mbi.t: Increment test count.
|
|
|
|
|
|
|
|
|
| |
# New Ticket Created by (Peter J. Acklam)
# Please include the string: [perl #81888]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81888 >
Signed-off-by: Abigail <abigail@abigail.be>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following standard definition is used: z is the modular inverse of
x (mod y) if and only if x*z (mod y) = 1 (mod y).
- dist/Math-BigInt/lib/Math/BigInt.pm: Fix the code in bmodinv() so it can
handle negative arguments. The code can be optimized further for speed,
but correctnes first.
- dist/Math-BigInt/t/bigintpm.inc: Fix the test case for modinv(-3, -5).
The output should be -3, since -3 * -3 (mod -5) = -9 (mod -5) = -4, and
1 (mod -5) = -4.
- dist/Math-BigRat/t/bigratpm.inc: Fix same test case as above.
Math::BigRat::bmodinv() only handles integers, and is essentially just a
front-end to Math::BigInt::bmodinv().
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Why: The Math::BigFloat->bcmp() method returns the wrong result when the
exponent is too large to be represented exactly as a Perl numerical
scalar. In such cases, bcmp() returns 0 because it fails to distinguish
between the two exponents.
How: With this fix, bcmp() does not convert the exponents to Perl
numerical scalars, but keeps them as arbitrary precision integers, thus
returning the correct result regardsless of the number of digits in the
exponent.
Test: Two tests added. These tests fail with the old code.
Files:
- lib/Math/BigFloat.pm: New version of bcmp().
- t/bigfltpm.inc: Add two tests confirming desired behaviour.
- t/bare_mbf.t: Increment test count.
- t/bigfltpm.t: Increment test count.
- t/sub_mbf.t: Increment test count.
- t/with_sub.t Increment test count.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Why: Math::BigInt::Calc->_num() converts a big integer (in the internal
format) to a Perl scalar. If the big integer is too large to be
represented as a Perl scalar, it might return a Perl scalar numeric
"nan", rather than "inf". The reason is that the current algorithm might
multiply "inf" by "0", giving a "nan" which propagates. The following
example illustrates the bug:
perl -MMath::BigInt=lib,Calc -wle \
'print Math::BigInt->new("1e999999")->numify()'
How: This fix computes the output in a different way, never multiply
"inf" by "0".
Test: It is not obvious to me how to test this automatically in a
portable way, since Perl has no standard way of stringifying a scalar
numeric infinity. However the desired behaviour is verified manually and
no existing tests fail with the new code.
|
|
|
|
|
| |
Core-only modules that have changed from v5.13.7, and dual-life modules
that have changed from v5.13.7 and didn't show up in earlier passes.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix the library method in lib/Math/BigInt/Calc.pm so that it
corresponds to the fact that a^b (mod 1) = 0 for all a and b.
- lib/Math/BigInt/Calc.pm: fix mentioned bug
- t/bigintpm.inc: add one more test case
- t/bare_mbi.t: increment test counter
- t/bigintpm.t: increment test counter
- t/sub_mbi.t: increment test counter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix _modpow() method in Math::BigInt::Calc so it correctly returns 0
in the case (0 ** $x) % $y, with $x > 0.
- lib/Math/BigInt/Calc.pm: fix mentioned bug
- t/bigintpm.inc: add a few more test cases
- t/bare_mbi.t: increment test counter
- t/bigintpm.t: increment test counter
- t/sub_mbi.t: increment test counter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The as_int/as_number methods lose precision because the wrong library
method is used for converting a library integer object to something that
is processed by Math::BigInt->new(). The method _num() returns a Perl
scalar, with an accuracy limited to the Perl's internal floating point
format. The correct is to use _str() which returns a string with all
digits preserved.
- t/bigfltpm.inc: add test case with more digits than is used in Perl's
internal floating point format.
- t/bigfltpm.t: increase number of tests by one.
- lib/Math/BigFloat.pm: changed library method from _num() to _str().
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The _digit($n) method in Math::BigInt::Calc should return 0 when $n
refers to a leading zero digit. E.g., the number '314' is just the
same as '000314', except that the leading zeros omitted, so _digit($n)
should return '0' when $n refers to a leading zero digit.
- lib/Math/BigInt/Calc.pm: Improve comments in source code. Add code
returning zero when input refers to a leading zero digit. Removed
redundant zero padding in temporary string argument to substr().
- t/bigintc.t: Add four test cases verifying the behaviour. Increment
number of test by four.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix lots of typos and spelling errors in the documentation (POD)
and the comments in the code, without changing any of the actual
(executed) code.
- BUGS: Fixed typos.
- CHANGES: Fixed typos.
- HISTORY: Fixed typos.
- TODO: Fixed typos.
- examples/bigprimes.pl: Fixed typos.
- lib/Math/BigFloat.pm: Fixed typos.
- lib/Math/BigInt/Calc.pm: Fixed typos.
- lib/Math/BigInt.pm: Fixed typos.
- t/bigintpm.inc: Fixed typos.
- t/inf_nan.t: Fixed typos.
- t/mbimbf.inc: Fixed typos.
- t/mbimbf.t: Fixed typos.
|