big-rational-str

Crates.iobig-rational-str
lib.rsbig-rational-str
version0.1.6
sourcesrc
created_at2020-10-17 14:20:24.269162
updated_at2023-03-08 13:08:18.528299
descriptionFormat and parse BigRationals to/from decimal numbers
homepage
repositoryhttps://gitlab.com/xamn/bigrational-str-rs
max_upload_size
id301406
size8,550
Samuel Kriikkula (XamNn)

documentation

README

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());
}
Commit count: 30

cargo fmt