```
Revision history for Math-AnyNum
0.38 2021-02-21
- Changed the result of `RATIONAL % INTEGER` to match the output of `ratmod`.
0.37 2021-01-19
- Added the `faulhaber_polynomial(n,x)` function (also aliased as `faulhaber`).
- Fixed some memory leaks in some special cases, such as `index(o, s)`, where `o` is a Math::AnyNum object.
0.36 2020-11-22
- Make a copy of Math::{GMPz,GMPq,MPC,MPFR} objects when passed to Math::AnyNum->new().
0.35 2020-09-13
[ADDITIONS]
- is_rough(n,k) true if all prime factors p|n are p >= k
- smooth_part(n,k) the largest k-smooth divisor of n
- rough_part(n,k) the largest k-rough divisor of n
- make_coprime(n,k) make n coprime to k by removing factors from n
- dirichlet_sum(n,...) the Dirichlet hyperbola method
- ratmod(r,m) modular rational operation, returning an integer
[IMPROVEMENTS]
- Optimizations in `sum(...)` for integer arguments.
- Optimizations in `faulhaber_sum(n,k)` for k = 2 and k >= n.
- Extended `powmod(b, n, m)` to support rational bases `b`.
- Internal code simplifications.
0.34 2020-01-23
- Increased the default value of `r` in `is_prime` from 20 to 23.
- Documented the Baillie-PSW test used by `is_prime` with GMP >= 6.2.0.
- LCM of an empty list, now returns 1. (previously returned 0)
0.33 2019-08-18
[ADDITIONS]
- Added the `digits2num(\@digits, $base)` function.
- Extended the method `length()` to accept an optional argument specifying the base.
[IMPROVEMENTS]
- Faster (subquadratic-time) algorithms in `digits(n,b)` and `sumdigits(n,b)` for bases b > 62.
- Minor optimizations in the `ilog(n,k)`, `ilog2(n)` and `ilog10(n)` functions.
0.32 2019-06-07
- Minor documentation improvements.
- Minor optimizations in the computation of the Lucas sequences.
- NaN is now returned for negative `n` in Lucas sequences.
0.31 2019-01-07
[ADDITIONS]
- Added the `min(@list)` and `max(@list)` functions.
- Added the `base(n,b)` function, which returns a string-representation of `n` in base `b`.
[IMPROVEMENTS]
- Minor optimization in `kronecker(n,k)` when `n` is a native integer or when both `n` and `k` are native integers.
[FIXES]
- Fixed `fibmod(0, m)` and `lucasmod(0, m)`.
- Fixed `is_prime(n)` for negative `n` to always return 0.
0.30 2018-12-13
- Fixed an `:overload` issue for integers in the range [2^32, 2^64] on 32-bit systems with 64-bit Perl.
0.29 2018-11-11
[ADDITIONS]
- is_smooth_over_prod(n,k) return 1 if n is smooth over the primes p|k
[IMPROVEMENTS]
- Much faster algorithm in `is_smooth(n, k)`.
- Cached the values of the `bernoulli(n)` function for `n <= 500`.
- Also cached the Bernoulli numbers that are internally used in `bernoulli_polynomial(n, x)` and `faulhaber_sum(n, k)`.
0.28 2018-09-29
[ADDITIONS]
- lucasU(p, q, n) Lucas U sequence
- lucasV(p, q, n) Lucas V sequence
- lucasUmod(p, q, n, m) Lucas U sequence mod m
- lucasVmod(p, q, n, m) Lucas V sequence mod m
- bit_scan0(n, k) index of the first 0-bit of n with index >= k
- bit_scan1(n, k) index of the first 1-bit of n with index >= k
- hamdist(n, k) Hamming distance (number of bit-positions where the bits differ)
- gcdext(n, k) return (u,v,d) where `u*n + v*k = d`
- is_congruent(n, k, m)` true if `n` is congruent to `k` mod `m`
[IMPROVEMENTS]
- More efficient algorithms in `fibmod(n, m)` and `lucasmod(n, m)`.
- Optimized the `div(Scalar, AnyNum)` case. It no longer converts the Scalar to a temporary object.
- Extended the `catalan()` function to accept an optional argument, computing the entries of Catalan's triangle `C(n,k)`.
0.27 2018-07-04
[ADDITIONS]
- Added the `laguerreL(n,x)` function for computing the Laguerre polynomials: `L_n(x)`.
- Added the `legendreP(n,x)` function for computing the Legendre polynomials: `P_n(x)`.
- Added the `chebyshevT(n,x)` and `chebyshevU(n,x)` functions for computing the Chebyshev polynomials of 1st and 2nd kind.
- Added the `hermiteH(n,x)` and `hermiteHe(n,x)` functions for computing the physicists' and probabilists' Hermite polynomials: `H_n(x)` and `He_n(x)`.
- Added the `secant_number(n)` and `tangent_number(n)` functions for computing the secant/zig numbers (A000364) and the tangent/zag numbers (A000182).
- Added the `fibmod(n,m)` and `lucasmod(n,m)` functions for efficiently computing the n-th Fibonacci and n-th Lucas number modulo m.
[IMPROVEMENTS]
- Optimized the case `sub(Scalar, AnyNum)` by using the `*_ui_sub()` functions from Math::{GMPz,MPFR,MPC}.
- Use `mpz_powm_ui()` in `powmod(n, k, m)` when `k` fits inside an unsigned native integer, as it is considerably faster than `mpz_powm()` for small `k`.
0.26 2018-05-30
[CHANGES]
- Boolification of `NaN` is now false (before `NaN` evaluated to a true value in boolean context, which was not very convenient).
[BUG-FIXES]
- Fixed `superfactorial(n)` and `hyperfactorial(n)` for n={0, 1}.
0.25 2018-05-25
[ADDITIONS]
- sum(a,b,c,...) sum of a list of numbers.
- prod(a,b,c,...) product of a list of numbers (using binary splitting).
- as_rat(n,b) rational string-representation of n in base b
- bell(n) n-th Bell number (OEIS: A000110)
- catalan(n) n-th Catalan number (OEIS: A000108)
- euler(n) n-th Euler number (OEIS: A122045).
- euler_polynomial(n, x) Euler polynomial (also available as `euler(n, x)`)
- bernoulli_polynomial(n, x) Bernoulli polynomial (also available as `bernoulli(n, x)`).
- geometric_sum(n,r) geometric sum: r^0 + r^1 + ... + r^n
- superfactorial(n) product of first n factorials
- lnsuperfactorial(n) natural logarithm of superfactorial(n)
- hyperfactorial(n) product of k^k for k=1..n
- lnhyperfactorial(n) natural logarithm of hyperfactorial(n)
- bsearch(n,\&f) binary search from 0 to n (exact match)
- bsearch(a,b,\&f) binary search from a to b (exact match)
- bsearch_le(n,\&f) binary search from 0 to n (less than or equal to)
- bsearch_le(a,b,\&f) binary search from a to b (less than or equal to)
- bsearch_ge(n,\&f) binary search from 0 to n (greater than or equal to)
- bsearch_ge(a,b,\&f) binary search from a to b (greater than or equal to)
[IMPROVEMENTS]
- Extended the `gcd()` and `lcm()` functions to accept an arbitrary number of arguments.
- Extended the optimizations in `digits(n, b)` and `sumdigits(n, b)` for all values of b <= 62.
- Extended the allowed value of `b` in `base(n, b)`, `as_int(n, b)`, `as_frac(n, b)` and `new(n, b`) to be between 2 and 62.
- Extended the `float(x)` function to convert `x` to any floating-point number, either real or complex (in this order).
- Documentation improvements: added a brief description for each function at the top of the POD file.
[INCOMPATIBLE CHANGES]
- Renamed the Euler-Mascheroni constant from `euler` to `EulerGamma`.
- Renamed the Catalan constant from `catalan` to `CatalanG`.
[OTHER]
- Increased the minimum required version of Perl from 5.14 to 5.16 (for `__SUB__`).
- Merged all the `AnyNum/*.pm` files into the main `AnyNum.pm` file.
0.24 2018-05-06
[ADDITIONS]
- Added the `sumdigits(n, b)` function, to sum the digits of `n` in base `b`.
- Added the `approx_cmp(x, y, [k])` function, to compare two numbers by first rounding them to k-th decimal places.
- Extended the `fibonacci()` function to accept an optional argument specifying the order of the Fibonacci numbers (2 = Fibonacci, 3 = Tribonacci, 4 = Tetranacci, ...).
[IMPROVEMENTS]
- Minor optimization in `ipow(n,k)` when `k` is an object and `n` is a native unsigned integer.
0.23 2018-04-09
[ADDITIONS]
- getbit(n, k), setbit(n, k), flipbit(n, k) and clearbit(n, k).
[OTHER]
- Stricter validation for native integers.
0.22 2018-02-17
[ADDITIONS]
- is_smooth(n, k) :: returns a true value when all the prime factors of `n` are <= `k`
- polymod(n, a, b, c, ...) :: computes the polymod of `n` against a list of numbers.
- subfactorial(n,k) :: computes the number of derangements of a set with `n` elements with `k` fixed points.
- multinomial(a, b, c, ...) :: computes the multinomial coefficient.
[IMPROVEMENTS]
- Minor performance improvement in the `mod(n,k)` method when `k` fits into a native unsigned integer.
[OTHER]
- Using the integer limits from Math::GMPq instead of POSIX. This makes POSIX no longer needed.
0.21 2018-01-25
- Extended the `complex()` function to accept an additional argument, which specifies the imaginary part.
- Reimplemented the `rat_approx()` method for much better performance (~3x faster).
- More efficient conversion of Math::GComplex objects with Math::AnyNum components.
0.20 2018-01-05
- Added parsing support for complex numbers in Cartesian form, such as "(3 4)" for "3+4i".
- Fixed the result of the `atan2(x, y)` function, when `x` and `y` are complex numbers.
0.19 2017-12-09
- Fixed some tests under mpfr-4.0.0.
- `mpfr_root()` is deprecated since mpfr-4.0.0 and is no longer used under mpfr >= 4.0.0.
- Using `mpfr_z_sub()` when mpfr >= 3.1.0 is available.
- Using `mpfr_beta()` when mpfr >= 4.0.0 is available.
0.18 2017-11-22
- Extended the `digits()` method to support arbitrary large bases.
+ Additionally, it returns the digits in reverse order, matching the output of the `.digits()` method from Ruby.
- Fixed a minor issue in `rat(str)` to return NaN when `str` cannot be parsed as a fraction.
- Fixed `polygonal_root(n, NaN)` to return `NaN` instead of `n`.
- Minor optimizations for `x <=> 0`, `x == 0` and `x != 0`, when `0` is a native integer.
0.17 2017-11-04
- Optimized `is_div(n, k)` when `n` and `k` are integers.
- Optimized `kronecker(n, k)` when `k` is a native integer.
- Improvements in `__bernfrac__(n)`, using a more optimized sieve for prime numbers.
- Minor simplifications inside `faulhaber_sum(n)`.
0.16 2017-10-17
- Fixed the numification of signed and unsigned integers close to the native integer limits.
0.15 2017-10-08
- Bug-fix in `gcd(x, -y)` and `lcm(x, -y)`, when `y` is a native integer.
- Minor internal optimizations.
0.14 2017-09-26
[BUG-FIXES]
- Fixed the sign in the results returned by the second-polygonal functions `polygonal_root2(n,k)` and `ipolygonal_root2(n,k)`.
0.13 2017-09-26
[ADDITIONS]
- acmp(x, y): absolute comparison of `x` and `y`.
- polygonal(n, k): returns the nth k-gonal number.
- polygonal_root(n, k): returns the k-gonal root of `n`.
- polygonal_root2(n, k): returns the second k-gonal root of `n`.
- ipolygonal_root(n, k): returns the integer k-gonal root of `n`.
- ipolygonal_root2(n, k): returns the second integer k-gonal root of `n`.
- is_polygonal(n, k): returns 1 when `n` is a k-gonal number.
- is_polygonal2(n, k): returns 1 when `n` is a second k-gonal number.
- faulhaber_sum(n, p): computes 1^p + 2^p + 3^p + ... + n^p, using Faulhaber's formula.
0.12 2017-09-18
[ADDITIONS]
- Added the `rat_approx(n)` function, which returns the smallest rational approximation for a given real number `n`.
[IMPROVEMENTS]
- The newly added functions in Math::MPFR-3.36, Rmpfr_q_div() and Rmpfr_z_div(), are now used by Math::AnyNum.
[PERFORMANCE OPTIMIZATIONS]
- Re-implemented all the methods without Class::Multimethods, which makes Math::AnyNum ~35% faster.
- Many internal simplifications and optimizations.
0.11 2017-07-11
[IMPROVEMENTS]
- Extended the `rising_factorial(n, k)` and `falling_factorial(n, k)` for negative values of `k`.
[PERFORMANCE IMPROVEMENTS]
- Optimized `eta(n)` and `zeta(n)` for values of `n` that fit inside a native unsigned integer.
[OTHER]
- Fixed the number of skipped tests under old versions of GMP in t/integer_functions.t.
0.10 2017-07-09
[ADDITIONS]
- Added the `exp2(x)` and `exp10(x)` functions.
- Added the `ipow2(x)` and `ipow10(x)` functions.
- Added the `falling_factorial(n, k)` and `rising_factorial(n, k)` functions.
[PERFORMANCE IMPROVEMENTS]
- Faster stringification of floating-point numbers (including complex numbers).
- Optimization in `mfactorial(n, m)` for native integers.
- Optimization in `binomial(n, k)` for values of `n` that fit inside a native unsigned integer.
[FIXES]
- Fixed `eta(NaN)` to return `NaN` instead of `log(2)`.
- Fixed `atanh(NaN)` to return `NaN` instead of `NaN+NaNi`.
- Fixed the return value of `lgrt(+i)` and `lgrt(-i)`.
0.09 2017-05-30
[ADDITIONS]
- Added the `is_coprime(n, k)` function.
[IMPROVEMENTS]
- Minor simplification for `eta(1)`.
- Minor optimization in `rand()` without arguments (when exported).
- Extended the `rat(str)` function to parse a given decimal expansion as an exact fraction.
- Re-implemented the `ilog(x, y)` function for better performance and to correctly handle arbitrary large integers.
[PERFORMANCE IMPROVEMENTS]
- ~4x faster algorithm in `bernfrac(n)`, due to Kevin J. McGown.
0.08 2017-05-08
[PERFORMANCE IMPROVEMENTS]
- Many internal simplifications and optimizations, which makes `Math::AnyNum` up to 30% faster.
[FIXES]
- Fixes a rounding error in ilog(n,b) when n is very large or when n is not a power of b.
0.07 2017-04-28
[IMPROVEMENTS]
- Minor optimization in `numify()` for integers and rationals.
- Added checks for exact divisibility of two integers.
- Optimized the gcd() and lcm() functions when the second argument is a native integer.
- Documentation improvements.
[FIXES]
- Fixed the creation of very large constant integers in `:overload` mode.
- Fixed the creation of binary, octal and hexadecimal constants that contain underscores (in `:overload` mode).
0.06 2017-04-18
[ADDITIONS]
- Added the `nude(x)` function.
- Added the `conj(x)` function.
- Added the `norm(x)` function.
- Added the `reals(x)` function.
- Added the `as_dec(x,y)` function.
[IMPROVEMENTS]
- Extended the `agm()` function to support complex numbers.
- Extended the `as_frac()` function to accept an optional base.
- Functions `inv(x)` and `neg(x)` are exportable.
- Math::AnyNum->new() is considerably faster.
- Many internal simplifications and optimizations.
[FIXES]
- Fixed a typo in `is_inf()` and `is_ninf()`.
0.05 2017-04-09
[FIXES]
- Fixed the (in)equality checks when one of the operands is NaN.
- Comparing anything to NaN, now returns `undef` instead of `0`.
[IMPROVEMENTS]
- Refactored the method `is_power` to handle scalar arguments more efficiently.
- Optimized the `root` and `iroot` method when the second argument is a scalar.
0.04 2017-04-08
[FIXES]
- Fixed some tests under GMP < 5.1.0 (thanks to Slaven ReziÄ‡; https://github.com/trizen/Math-AnyNum/issues/1).
- Workaround in log10() with MPC < 1.0 (thanks to Slaven ReziÄ‡; https://github.com/trizen/Math-AnyNum/issues/1).
0.03 2017-04-08
[IMPROVEMENTS]
- Minor optimization in overloaded '-' and '/'.
[FIXES]
- Workaround for Math::GMPq::Rmpq_cmp_z() with a version of GMP older than 6.1.0. (https://rt.cpan.org/Public/Bug/Display.html?id=120910)
- Minor-fix in the stringification of Math::MPFR objects with exponents and trailing zeros.
0.02 2017-04-03
Require perl>=5.014.
0.01 2017-04-03
First release.
```