diff --git a/primitives/src/math/fixed.rs b/primitives/src/math/fixed.rs index 0083799f3..f977563a2 100644 --- a/primitives/src/math/fixed.rs +++ b/primitives/src/math/fixed.rs @@ -253,7 +253,7 @@ impl> FromFixedToDecimal for N { let mut increment = false; let new_frac_part = if frac_part.len() < decimals_usize { - format!("{}{}", frac_part, "0".repeat(decimals_usize - frac_part.len())) + format!("{}{}", frac_part, "0".repeat(decimals_usize.saturating_sub(frac_part.len()))) } else { // Adding rounding behavior let round_digit = frac_part.chars().nth(decimals_usize);