pub fn normalize_amount(amount: Decimal, precision: u8) -> DecimalExpand description
Normalizes the given amount by truncating it to the specified decimal precision.
Amounts within 1e-9 of a step at precision (in units of that step) snap to the step
instead, so upstream floating-point artifacts such as 2.9999999999999996 keep their
intended size.
ยงPanics
Panics if precision exceeds 19, beyond which the tolerance is not representable.