Closed brunbjerg closed 2 months ago
It matches the behaviour of the standard library in similar situations, but it's easy enough to do so I see no reason not to.
It matches the behaviour of the standard library in similar situations, but it's easy enough to do so I see no reason not to.
Yeah I just test with:
fn main() {
let float: f64 = 0.5;
let integer = float as u32;
println!("{}", integer);
}
$ 0
I believe that the documentation should be added only if there is a clear consensus that the current version is misleading
All the methods that takes a reference to a Decimal object and returns an integer type, round the Decimal down to nearest integer, without any explicit mentioning of this. The current documentation for the Decimal::to_u64(&self) -> Option simply says:
Would it make sense for me to (at least) add to the method documentations that the calls are dropping the fractional part? Or is this kind of thing implied when using the crate?