Releases: trizen/Math-BigNum
Version 0.20
ADDED
- Added the
remove(n,k)
andbremove(n,k)
methods, for removing all occurrences of the factork
from integern
. (acf1237)
IMPROVEMENTS
- Re-implemented the
mod
method based on the identity:x % y = x - y*floor(x/y)
, which always returns the exact result, assuming thatx
andy
are rational numbers. (a622167)
FIXES
- Fixed a special case in
modpow(x, y, z)
wheny < 0
andgcd(x, z) != 1
. (f624550) - Fixed a minor issue in
broot(x, y)
wheny
is not an integer. (f635807) - Fixed a minor issue in
bfpow(x, y)
wheny
is a non-numeric scalar. (023b784)
All changes: 0.19...0.20
Version 0.17
ADDED
- isqrtrem(n) : the integer square root and the remainder.
- irootrem(n) : the integer nth root and the remainder.
- eta(n) : the Dirichlet eta function at n.
- beta(x,y) : the beta function (for x > 0 and y > 0).
- lambert_w(x) : the Lambert W function (for x >= -1/e)
- rad2deg(n) : converts radians to degrees
- deg2rad(n) : converts degrees to radians
- bessel_j(x,n) : the first order Bessel function: J_n(x).
- bessel_y(x,n) : the second order Bessel function: Y_n(x).
FIXES
- Fixed the accuracy in the method bernreal() for small n.
- Fixed a special case in the method irand() when the self value is 0.
- irand(0) = 0
OTHER
- Minor optimization in the decimal expansion of non-integers.
Version 0.16
ADDED
- Added two methods for computing the nth-Harmonic number:
- harmfrac(n)
- harmreal(n)
- Added two methods for reseeding the pseudorandom number generator:
- seed(n)
- iseed(n)
IMPROVEMENTS
- Extended the method digits() to accept an optional base.
digits(4095, 16) #=> ('f', 'f', 'f')
BUG FIXES
- Using threads in some parts of the program, will no longer cause a segmentation fault.
However, Math::BigNum is not thread-safe, therefore using Math::BigNum objects inside threads, still causes a segmentation fault.
Version 0.15
ADDED
- Unimport support.
no Math::BigNum; # disables the `:constant` behavior in the current scope
- Added the
new_int()
andnew_uint()
methods for setting signed and unsigned native integers.
PERFORMANCE IMPROVEMENTS
- Noticeable optimizations in method
is_pow()
.- Thanks to Dana Jacobsen - @danaj.
- Minor optimization in
bernfrac()
for values of n < 50. - Faster algorithm in
bernfrac()
for values ofn
>= 50. (based on the Zeta function) - Faster algorithm in
bernreal()
, using positive values of the Zeta function. (before, negative values were used)
BUG FIXES
- When a base is specified, special values, such "Inf" and "NaN", are no longer parsed specially.
Math::BigNum->new('inf', 36) == 24171;
Math::BigNum->new('nan', 36) == 30191;
OTHER
- Documentation improvements.
More changes: 0.14...0.15
Version 0.14
- Fixed a minor bug inside the method
n->is_pow(p)
whenn
is negative (for old versions of GMP).
Version 0.13
- Added the
bernfrac
method, powered by an improved version of Seidel's algorithm. - Stricter validation of the precision specified as an import value.
- Minor bug-fix in the method
is_pow
foris_pow(-1, odd_n)
-- it now returns true. - Fixed some special cases in the method
iroot
. - Fixed a special case in the method
valuation
when the second argument is0
.
Version 0.12
- Decreased the default floating-point precision from 256 bits, to 200 bits.
- Added support for specifying the default precision as an import value.
use Math::BigNum PREC => 1024;
- Fixed a minor-bug in the method
is_pow
for some special cases. - Minor POD fixes.
Version 0.11
-
Added the
$n->parts
method, which returns the numerator and the denominator as BigNum objects. -
Support for rational exponentiation with an integer power.
(3/5)**3 == 27/125
-
Added the
$x->li
method for computing the logarithm integral of$x
. -
Added the
$n->bernreal
method, which returns the nth-Bernoulli number as a floating-point value. -
Added the
$n->kronecker($k)
method, which returns the Kronecker symbol (n|k). -
Added the following exportable functions:
factorial(n) # product of first n integers: n! primorial(n) # product of primes <= n binomial(n,k) # binomial coefficient fibonacci(n) # nth-Fibonacci number lucas(n) # nth-Lucas number ipow(a,k) # integer exponentiation: int(a^k)
-
Added the method
$n->popcount
, which returns the number of 1s in the binary representation of$n
. -
Added the
:all
option to export anything that is exportable (functions + constants). -
Added the
$n->valuation($k)
method, which returns the number of times$n
is divisible by$k
. -
Added the
$x->bfloat
method, which truncates$x
in-place to a floating-point value. -
Added the method
$n->is_pow($k)
, which returns true iffa^k = n
for some positivea
. -
Added the method
$x->lgrt
, which returns the logarithmic-root of$x
.100->lgrt # solves for x in `x**x = 100` and returns: `3.59728...`
-
Added the following floating-point methods:
(b)fadd (b)fsub (b)fmul (b)fdiv (b)fmod (b)fpow
Improvements
- Extended the method
float
to accept an optional argument with the number of bits of precision. - Optimized the
$k->root($n)
method for positive integer values of$n
. - Increased the default accuracy value for the method
is_prime
from 12 to 20. - Increased the default precision of floating-point numbers from 128 to 256 bits.
Changes
- Changed the return values of the
sign
method from ("-", "", "+") to (-1, 0, 1). - Some minor bug-fixes and documentation improvements.
Version 0.10
What's new
- Faster creation of MPFR objects from scalar integer values (aa3ee61).
- Conversion of scalar values to MPFR objects is done more strictly, by validating each conversion.
- Added the missing
[b|i]mul
methods in theNan
class (1b5792c). - Minor overall performance improvements, by taking advantage of some commutative properties.
- Added the
bln()
method, which calculates the natural logarithm in-place (71bef20). - Stricter definitions for the
log
andblog
methods when one of the arguments is +/-Infinity (7140567). - Require Math::GMPz >= 0.39 (for Rmpz_bin_si) (4de9f99).
- Use Math::GMPq's (>=0.41)
_ulong_max()
and_long_min()
to determine the integer limits (4e7856b).
Version 0.09
What's new
- Better support for scalar values. (c2359d5)
- Better performance for
idiv()
andbidiv()
when called with negative scalar integers. - Faster creation of Math::BigNum objects with scalar integer values.
- Scalar values passed to
(b)i*
methods are now validated or converted correspondingly.