Changes for version 0.11 - 2016-04-10
- Added the `$n->parts` method, which returns the numerator and the denominator as BigNum objects.
- Increased the default accuracy value for the method `is_prime` from 12 to 20.
- Support for rational exponentiation with an integer power.
- Example: (3/5)**3 == 27/125
- Added the `$x->li` method for computing the logarithm integral of `$x`.
- Optimized the `$k->root($n)` method for positive integer values of `$n`.
- 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`.
- Changed the return values of the `sign` method from ("-", "", "+") to (-1, 0, 1).
- 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`.
- Extended the method `float` to accept an optional argument with the number of bits of precision.
- 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 iff `a^k = n` for some positive integer `a`.
- 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...`
- 3125->lgrt # returns `5` because `log(3125)/log(5) == 3125->root(5)`
- Added the following floating-point functions:
- (b)fadd (b)fsub (b)fmul (b)fdiv (b)fmod (b)fpow
- Increased the default precision of floating-point numbers from 128 to 256 bits.
- Some minor bug-fixes and documentation improvements.
Modules
Arbitrary size precision for integers, rationals and floating-point numbers.
Represents the +/-Infinity value.
Represents the Not-a-Number value.
Examples
- examples/agm_pi.pl
- examples/arithmetic_coding.pl
- examples/bernoulli_numbers_recursive.pl
- examples/binary_arithmetic_coding.pl
- examples/binradix_arithmetic_coding.pl
- examples/closed_form_fib.pl
- examples/coin_change.pl
- examples/computing_pi.pl
- examples/faulhaber_s_formula.pl
- examples/fibonacci_validation.pl
- examples/inverse_of_factorial.pl
- examples/pi_machin.pl
- examples/power_pairs.pl
- examples/prime_count_approx.pl
- examples/rsa_algorithm.pl
- examples/tac-compressor.pl
- examples/zeta_2n.pl