Expand description
Utilities for rounding money amounts to the nearest hundredth or ten-thousandth part.
assert_rounded_* helpers are intended for tests and doctests (they assert! on
non-finite inputs). Production code should prefer comparing with round_4 / round_6
or structured crate::FinanceError handling rather than assert-based helpers.
Functionsยง
- assert_
rounded_ 2 - assert_
rounded_ 4 - assert_
rounded_ 6 - assert_
rounded_ 8 - round_2
- Round to two decimal places. This function uses f64::round() which rounds halfway cases away from 0.0.
- round_4
- Round to four decimal places. This function uses f64::round() which rounds halfway cases away from 0.0.
- round_6
- Round to six decimal places. This function uses f64::round() which rounds halfway cases away from 0.0.
- round_8
- Round to eight decimal places. This function uses f64::round() which rounds halfway cases away from 0.0.