Skip to content

Commit

Permalink
print out warning when parsing potential problems
Browse files Browse the repository at this point in the history
  • Loading branch information
doehyunbaek committed Aug 26, 2024
1 parent b5393c6 commit 1814545
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/replay_gen/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ fn parse_number(s: &str) -> Option<F64> {
"-Infinity" => Some(F64(std::f64::NEG_INFINITY)),
_ => {
if let Ok(num) = s.parse::<f64>() {
let round_trip = num.to_string();
if round_trip != s {
eprintln!("WARNING: roundtrip of {s}: {round_trip}");
}
Some(F64(num)) // Handle floats and scientific notation
} else {
None // Not a number
Expand Down

0 comments on commit 1814545

Please sign in to comment.