Skip to content

Commit

Permalink
Disable exponential form if formatting with precision
Browse files Browse the repository at this point in the history
  • Loading branch information
akubera committed Oct 28, 2024
1 parent b1d6a1d commit 75ad99c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/impl_fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ fn dynamically_format_decimal(
let trailing_zero_threshold = trailing_zero_threshold as u64;

// use exponential form if decimal point is outside
// the upper and lower thresholds of the decimal
if leading_zero_threshold < leading_zero_count {
// the upper and lower thresholds of the decimal,
// and precision was not requested
if matches!(f.precision(), None) && leading_zero_threshold < leading_zero_count {
format_exponential(this, f, abs_int, "E")
} else if trailing_zero_threshold < trailing_zeros {
// non-scientific notation
Expand Down

0 comments on commit 75ad99c

Please sign in to comment.