Skip to content

Commit 4f1232a

Browse files
committed
Fix error of CI
1 parent 8c892f2 commit 4f1232a

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

vm/src/format.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -369,16 +369,22 @@ impl FormatSpec {
369369
Some(FormatType::Number) => {
370370
Err("Format code 'n' for object of type 'float' not implemented yet")
371371
}
372-
Some(FormatType::GeneralFormatUpper) => Ok(float_ops::format_general(
373-
precision,
374-
magnitude,
375-
float_ops::Case::Upper,
376-
)),
377-
Some(FormatType::GeneralFormatLower) => Ok(float_ops::format_general(
378-
precision,
379-
magnitude,
380-
float_ops::Case::Lower,
381-
)),
372+
Some(FormatType::GeneralFormatUpper) => {
373+
let precision = if precision == 0 { 1 } else { precision };
374+
Ok(float_ops::format_general(
375+
precision,
376+
magnitude,
377+
float_ops::Case::Upper,
378+
))
379+
}
380+
Some(FormatType::GeneralFormatLower) => {
381+
let precision = if precision == 0 { 1 } else { precision };
382+
Ok(float_ops::format_general(
383+
precision,
384+
magnitude,
385+
float_ops::Case::Lower,
386+
))
387+
}
382388
Some(FormatType::ExponentUpper) => Ok(float_ops::format_exponent(
383389
precision,
384390
magnitude,

0 commit comments

Comments
 (0)