4 releases

0.1.6 Mar 8, 2023
0.1.5 Mar 26, 2022
0.1.4 Feb 8, 2022
0.1.3 Oct 18, 2020

#614 in Algorithms

Download history 39/week @ 2024-01-07 94/week @ 2024-01-14 60/week @ 2024-01-21 83/week @ 2024-01-28 153/week @ 2024-02-04 150/week @ 2024-02-11 31/week @ 2024-02-18 71/week @ 2024-02-25 104/week @ 2024-03-03 25/week @ 2024-03-10 38/week @ 2024-03-17 35/week @ 2024-03-24 35/week @ 2024-03-31 10/week @ 2024-04-07 12/week @ 2024-04-14 20/week @ 2024-04-21

77 downloads per month
Used in rpn-cli

Custom license

8KB
156 lines

big-rational-str

Crate for formatting and parsing BigRationals (of the popular 'num' crate) in decimal form.

Converts fractions to decimal strings and vice versa

BigRational String
1/3 "0.(3)"
-93/52 "-1.78(846153)"
30/4 "7.5"
550/-1 "-550"

Usage

use big_rational_str::*;

fn main() {
    let big_rational = str_to_big_rational("3.(3)").unwrap();
    println!("{}", big_rational_to_string(big_rational));
    
    let big_rational2 = BigRational::from_dec_str("3.(3)").unwrap();
    println!("{}", big_rational2.to_dec_string());
}

Dependencies

~2.8–4.5MB
~81K SLoC