Crate beetle_fraction

source ·
Expand description

Beetle-Fraction

A set of functions and structs for doing math with rational numbers.

Example program:

fn main() {
    let half = frac![1, 2];
    assert_eq!(half * half, frac![1, 4]);
}

Modules

  • Big-Fraction type & its trait implementations
  • Fraction type & its trait implementations
  • Macros for creating and manipulating Fractions
  • A prelude for frequently used types, traits, & macros
  • ….traits
  • Type definitions & their non-trait impl’s

Macros

  • Shorthand for BigFraction::from(Fraction::new(x, y))
  • Shorthand for Fraction::new(x, y);
  • Shorthand for Fraction::new(x, 1);
  • Shorthand for Fraction::new(1, y);