mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Fix panic with high precision
This commit is contained in:
1 file changed
+1
@@ -55,6 +55,7 @@ pub fn format_fixed(precision: usize, magnitude: f64, case: Case, alternate_form
|
||||
match magnitude {
|
||||
magnitude if magnitude.is_finite() => {
|
||||
let point = decimal_point_or_empty(precision, alternate_form);
|
||||
let precision = std::cmp::min(precision, u16::MAX as usize);
|
||||
format!("{magnitude:.precision$}{point}")
|
||||
}
|
||||
magnitude if magnitude.is_nan() => format_nan(case),
|
||||
|
||||
Reference in new issue
Block a user