Crate factorion_math

Crate factorion_math 

Source
Expand description

§Factorion Math

The math functions used by factorion. (Factorials and related functions) All functions that take Integers, but internally use Floats, not only have a float alternative, but also take in a precision.

This crate uses rug in its interface. It is re-exported for convenience.

§Features

  • k-factorials in exact, float, approximate, approximate digits
  • termials in exact, float, approximate, approximate digits
  • k-termials in exact, approximate, approximate digits
  • subfactorials in exact, approximate, approximate digits

Calculations are split in areas:

  • exact: integer calculation (accuracy)
  • float: float calculation (decimals)
  • approximate: approximation of integer calculation using float as a * 10^b (large numbers)
  • approximate digits: approximation of integer calculation using float as 10^b (extremely large numbers)

Formulas and their derivations are available in MATH.md

Re-exports§

pub use rug;

Modules§

recommended
Recommended constants

Constants§

APPROX_FACT_SAFE_UPPER_BOUND_FACTOR

Functions§

adjust_approximate
Adjusts the output of approximate_factorial, by combining the 10 exponents of the number and the extra exponent.
approximate_approx_termial
The k-termial of x * 10^e as a * 10^b
approximate_factorial
Calculates Sterling’s Approximation of large factorials. Returns a float with the digits, and an int containing the extra base 10 exponent.
approximate_factorial_float
Calculates Sterling’s Approximation of large factorials. Returns a float with the digits, and an int containing the extra base 10 exponent.
approximate_multifactorial
Calculates an approximation of the multifactorial using the sterling aproximation and the fractional multifactorial algorithm.
approximate_multifactorial_digits
Calculates the approximate digits of a multifactorial. This is based on the base 10 logarithm of Sterling’s Approximation.
approximate_multifactorial_digits_float
Calculates the approximate digits of a multifactorial. This is based on the base 10 logarithm of Sterling’s Approximation.
approximate_multifactorial_float
Calculates an approximation of the multifactorial using the sterling aproximation and the fractional multifactorial algorithm.
approximate_subfactorial
The subfactorial of n as a * 10^b
approximate_subfactorial_float
The subfactorial of n as a * 10^b
approximate_termial
The k-termial of n as a * 10^b
approximate_termial_digits
The k-termial of n as 10^b
approximate_termial_digits_float
approximate_termial_float
The k-termial of n as a * 10^b
factorial
The k-factorial of n
fractional_factorial
The factorial of x (using gamma)
fractional_multifactorial
Calculates the k-factorial of x.
fractional_termial
The termial of x
length
Number of digits of n (log10, but 1 if 0)
multitermial
The k-termial of n
negative_multifacorial_factor
The k-factorial of -n is the factorial of n-k times this factor (inf if None)
subfactorial
The subfactorial of n
termial
The termial of n