pub fn round_int_with_precision(value: i64, precision: i16) -> Option<i64>Expand description
This is used for rounding into integer digits, and is a no-op for positive
precision.
If precision is negative, returns value with n less significant integer
digits from the first digit where n is -precision. Standard rounding
rules apply to the first remaining significant digit (if nth digit from
the first digit >= 5, round away from zero).
Note that this may return None for negative precision when rounding
beyond i64::MAX or i64::MIN.
ยงExamples
let rounded = round_int_with_precision(-154, -2);
assert_eq!(Some(-200), rounded);
let rounded = round_int_with_precision(823543, -3);
assert_eq!(Some(824000), rounded);