Skip to content

Commit

Permalink
Update src/store.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
gillchristian authored Oct 14, 2024
1 parent 79cd51a commit 7e9ed2a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,10 @@ impl<'a> InnerStoreLocked<'a> {
value += increment;

let value = match value.to_f64() {
Some(v) if v.fract() == 0.0 => format!("{:.0}", v), // Format as an integer if no fractional part.
Some(v) => format!("{:.17}", v), // Format as a float with up to 17 digits of precision.
// Format as an integer if no fractional part.
Some(v) if v.fract() == 0.0 => format!("{:.0}", v),
// Format as a float with up to 17 digits of precision.
Some(v) => format!("{:.17}", v),
// This shouldn't happen since we're only using ints and floats, but ideally, a trait
// would enforce this at compile time.
None => return Err(err.to_string()),
Expand Down

0 comments on commit 7e9ed2a

Please sign in to comment.