Currency: Difference between revisions
→{{header|Rust}}: changing an f64 to a Currency is dangerous as the original has limited precision - need to add round() before casting to i64
m (→{{header|Phix}}: mpfr_get_fixed now ok.) |
(→{{header|Rust}}: changing an f64 to a Currency is dangerous as the original has limited precision - need to add round() before casting to i64) |
||
Line 1,989:
fn new(num: f64) -> Self {
Self {
amount: BigRational::new(((num * 100.0).round() as i64).into(), 100.into())
}
}
|