Closed MamfTheKramf closed 1 year ago
This is intentionally designed as so. The precision of "0.25" and "1000" are 3 and 4 respectively, so the result will have a precision of 4 by default. If you want unlimited precision, you can set the precision to zero. Try:
let a = Decimal::from_str_native("0.25").unwrap().with_precision(0).value();
let b = Decimal::from_str_native("1000").unwrap().with_precision(0).value();
println!("a + b: {}", a + b);
let a = Real::ONE << 8; // Real::ONE already has a precision of 0
let b = Real::from_str_native("0.101101").unwrap().with_precision(0).value();
println!("a + b: {}", a + b);
Maybe I should add a separate function to explicitly mark the number has unlimited precision.
If this is intentional, then everything is alright. I just wanted to make sure that this isn't some behaviour that was supposed to be fixed by simply choosing the max-precision.
The precision of the result of a binary oparation between two
FBig
s (e.g.add
) is the maximum of the precision of the arguments, as stated in the documentation. But this leads to some probably undesired behaviour. For example in this code:Maybe the precision-computation for such oparations should be changed such that no loss occurs.