summaryrefslogtreecommitdiff
path: root/dist/Math-BigInt
Commit message (Collapse)AuthorAgeFilesLines
* Fix some long lines in BigInt.pmFather Chrysostomos2013-08-231-190/+194
|
* Long verbatim pod lines in BigFloat.pmFather Chrysostomos2013-08-231-18/+19
|
* Add bint() method for rounding towards zero.Peter John Acklam2013-08-2313-27/+90
| | | | | | | | | | | | | 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().
* bump versions for Math::BigInt and Math::BigFloatTony Cook2013-08-232-2/+2
|
* Clean up POD for Math::BigInt and Math::BigFloatTony Cook2013-08-232-169/+175
| | | | | | | | | | | | | | 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
* typo fixes for Math-BigIntDavid Steinbrunner2013-05-274-20/+20
|
* fix various podcheck nitsDavid Golden2013-05-231-4/+8
|
* Math-BigInt: Fix some broken linksKarl Williamson2013-03-183-6/+6
|
* Fix various minor pod issuesKarl Williamson2013-01-241-2/+2
| | | | | These were all uncovered by the new Pod::Checker, not yet in core. Fixing these will speed up debugging the new Checker.
* Increase $Math::BigInt::VERSION to 1.998Father Chrysostomos2012-01-161-1/+1
|
* BigInt.pm: Suppress overload warningFather Chrysostomos2012-01-161-0/+3
| | | | BigInt.pm intentionally registered an unregisterable op.
* [perl #98280] Use same version number 1.997 in all .pm files.Peter John Acklam2011-09-023-3/+3
| | | | | - For simplicity, use same version number 1.997 in all .pm files to match the upcoming release 1.997 of the Math-BigInt distribution.
* [perl #98256] Add POD for the bsgn() method.Peter John Acklam2011-09-011-0/+7
| | | | | This stops Pod::Coverage (and possibly users) from complaining about missing documentation.
* Bump Math::Big(In|Floa)t versionsFather Chrysostomos2011-09-012-2/+2
|
* remove incorrect formatting inside verbatim paragraphsAlexandr Ciornii2011-09-011-23/+23
|
* Correct links to sections (and modules in case of BigFloat.pm)Alexandr Ciornii2011-09-012-23/+23
|
* Rewrap some verbatim pod in Math::BigIntFather Chrysostomos2011-08-101-116/+127
| | | | | I started to make Math::BigInt’s pod fit within 79 columns, but soon petered out. At least this is better than nothing.
* Keep verbatim pod in various dist/* pods within 79 colsFather Chrysostomos2011-08-101-158/+162
|
* Remove x bit from rt-16221.tFather Chrysostomos2011-06-111-0/+0
|
* Increase Math::BigInt’s versionFather Chrysostomos2011-06-111-1/+1
|
* Increase Math::BigFloat’s versionFather Chrysostomos2011-06-111-1/+1
|
* Fix Math::BigFloat->numify().Peter John Acklam2011-06-112-12/+17
| | | | | | | | | | | | | | 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 objectify()'s handling of "foreign objects".Peter John Acklam2011-06-112-87/+199
| | | | | | | | | | | | | | - 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.
* Add sign function bsgn() as a complement to babs().Peter John Acklam2011-06-115-4/+24
| | | | | | | 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.
* Increase Math::BigInt’s versionFather Chrysostomos2011-03-071-1/+1
| | | | There is a 1.993 release on CPAN. There have been more changes since.
* [perl #85482] Make bmuladd() able to handle third arg properly.Peter John Acklam2011-03-052-12/+2
| | | | | | | | | 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.
* [perl #85476] Add tests to confirm fix of RT #49569.Peter John Acklam2011-03-054-3/+24
| | | | | | 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.
* [perl #85334] Document actual behaviour of from_xxx() methods.Peter John Acklam2011-03-051-0/+13
| | | | | Add more precise documentation of the behaviour of from_oct(), from_hex(), and from_bin().
* Update Math::BigInt to CPAN version 1.993Peter John Acklam2011-02-254-8/+8
| | | | | | | | | | | # 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).
* Update Math::BigInt to CPAN version 1.992Peter John Acklam2011-02-186-144/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [perl #83406] Library compatibility and API documentation (v1.991).pjacklam2011-02-054-127/+415
| | | | | | | | | | | | | | - 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.
* bmodpow() fails when GMP library is used.Peter John Acklam2011-01-281-7/+8
| | | | | | | | | | | | | | | | | | | | | | | 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";
* Remove training whitespace in Pod which can confuse pod/buildtocNicholas Clark2011-01-214-58/+57
| | | | | | 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
* Bumped Math-BigInt, Math-BigInt-FastCalc and Math-BigRat versions for ↵Jesse Vincent2011-01-203-3/+3
| | | | release per cmpVERSION.pl
* [perl #82098] Fix RT 61543 and remaining part of RT 63237Peter John Acklam2011-01-165-25/+250
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix typos (spelling errors) in dist/*Peter J. Acklam) (via RT2011-01-0712-25/+25
| | | | | | | | | # 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>
* [perl #81400] Fix bmodinv() part of RT 63237Peter John Acklam2011-01-022-26/+73
| | | | | | | | | | | | | | | | | 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().
* Calc.pm: Fix _modpow() part of RT#63237Peter John Acklam2010-12-261-1/+1
|
* Fix RT 62764: Math::BigFloat->bcmp() fails.Peter John Acklam2010-12-266-51/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix RT 25274: Math::BigInt::Calc->_num() overflow.Peter John Acklam2010-12-261-9/+14
| | | | | | | | | | | | | | | | | | | | 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.
* bump version of many modulesZefram2010-12-194-4/+4
| | | | | 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.
* Spelling: reminder -> remainderPeter John Acklam2010-11-306-11/+11
|
* Sync version of dist/Math-BigInt modules to 1.99_01 as per Florian's requestChris 'BinGOs' Williams2010-11-194-4/+4
|
* Upgrade Math::BigInt from version 1.98 to 1.99Florian Ragwitz2010-11-153-3/+3
|
* RT ticket 62949: $x -> bmodpow(1, 1) fails when $x is largePeter John Acklam2010-11-145-6/+7
| | | | | | | | | | | | | | | 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
* RT ticket 62918: _modpow(x,y,z) with x = 0 and y > 0Peter John Acklam2010-11-125-8/+16
| | | | | | | | | | | | | | | 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
* RT ticket #43694: as_int/as_number lose precisionPeter John Acklam2010-11-106-5/+6
| | | | | | | | | | | | | | | | 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().
* Upgrade Math::BigInt to version 1.98Florian Ragwitz2010-11-083-3/+3
|
* RT ticket #61812: digit($n) with $n "out of range"Peter John Acklam2010-11-072-11/+13
| | | | | | | | | | | | | | 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.
* RT ticket #62643: typos in POD and code commentsPeter John Acklam2010-11-077-28/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.