use bigdecimal::BigDecimal;
use num::bigint::BigInt;
use num::rational::Ratio;
use num::traits::FromPrimitive;
use num::traits::ToPrimitive;
fn main() {
{
// let x: Ratio<BigInt> = Ratio::from_integer(577_u64.into());
// let y: Ratio<BigInt> = Ratio::from_integer(408_u64.into());
let x: Ratio<BigInt> = Ratio::from_float(577.0).unwrap();
let y: Ratio<BigInt> = Ratio::from_float(408.0).unwrap();
println!("{:.64}", Ratio::to_f64(&(x / y)).unwrap());
}
{
let x = BigDecimal::from_f64(577.0).unwrap();
let y = BigDecimal::from_f64(408.0).unwrap();
println!("{:.64}", x / y);
}
}
// rational
// 1.4142156862745098866440685014822520315647125244140625000000000000
// decimal
// 1.4142156862745098039215686274509803921568627450980392156862745098
// wolfram
// 1.4142156862745098039215686274509803921568627450980392156862745098
What am I doing wrong?