-
-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Creating a small decimal when using u32 as type data sometimes gives NaN instead of 0.
Code:
pub type Dec = fraction::GenericDecimal<u32, u8>;
let d = Dec::from(0.0000000001);
println!("{d:?}");Output:
GenericDecimal(NaN | prec=0; NaN; NaN)
Testing a bit more:
Dec::from(0.000000001)=>GenericDecimal(0.000000001 | prec=9; Rational(Plus, Ratio { numer: 1, denom: 1000000000 }); 0.000000001)Dec::from(0.0000000001);=>GenericDecimal(NaN | prec=0; NaN; NaN)- ...
Dec::from(0.000000000000001);=>GenericDecimal(NaN | prec=0; NaN; NaN)Dec::from(0.0000000000000001);=>GenericDecimal(0 | prec=0; Rational(Plus, Ratio { numer: 0, denom: 1 }); 0)
Version: "0.15.3"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels