tcorp_math_mods 0.1.0

This will be a growing collection of helpful math functions and algorythems all of which will be abstracted into generic types.
Documentation
  • Coverage
  • 0%
    0 out of 4 items documented0 out of 2 items with examples
  • Size
  • Source code size: 15.78 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 296.76 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 16s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • thetyrelcorporation/tcorp_math_mods
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • thetyrelcorporation

TCorp Math Mods

This will be a growing collection of helpful math functions and algorythems all of which will be abstracted into generic types.

Factors

Install and initialize with

extern crate tcorp_math_mods;
use tcorp_math_mods::factors;

Special thanks to Kendall at http://stackoverflow.com/questions/110344/algorithm-to-calculate-the-number-of-divisors-of-a-given-number for the fastest factorization algorithm ever. Both functions rely on a ported and slightly modified version.

There are two methods currently.

The first is number_of_factors(n:T) which returns the number of factors for parameter n in the same type as parameter n.

let x: u32 = 7;
assert_eq!(factors::number_of_factors(x), 2); // Will pass and the return type will be u32

The second function is factors_for(n:T) which returns a vector of all factors for a given n.

let x: i64 = 100;
assert_eq!(factors::factors_for(x), ); // Will pass and the return type will be Vec<i64>