diff --git a/crates/engine/src/file_cmds.rs b/crates/engine/src/file_cmds.rs index 2299aa3e49..2cf3ce6fb1 100644 --- a/crates/engine/src/file_cmds.rs +++ b/crates/engine/src/file_cmds.rs @@ -765,7 +765,7 @@ fn exposure_text(t: f64) -> Option { return None; } let r = 1.0 / t; - if t < 1.0 && (r - r.round()).abs() <= r * 0.01 { + if t < 1.0 && r.round() > 1.0 && (r - r.round()).abs() <= r * 0.01 { return Some(format!("1/{} s", r.round())); } Some(format!("{} s", short_num(t, if t < 1.0 { 2 } else { 1 }))) diff --git a/crates/engine/src/file_cmds/tests.rs b/crates/engine/src/file_cmds/tests.rs index b07c649850..d00719b2b4 100644 --- a/crates/engine/src/file_cmds/tests.rs +++ b/crates/engine/src/file_cmds/tests.rs @@ -1354,3 +1354,10 @@ fn batch_naming_rejects_outputs_that_replace_inputs_before_processing() { assert_eq!(std::fs::read(&first).unwrap(), before[0]); assert_eq!(std::fs::read(&second).unwrap(), before[1]); } + +#[test] +fn exposure_text_near_one_second_is_not_one_over_one() { + assert_eq!(exposure_text(0.996).as_deref(), Some("1 s")); + assert_eq!(exposure_text(0.99).as_deref(), Some("0.99 s")); + assert_eq!(exposure_text(1.0 / 250.0).as_deref(), Some("1/250 s")); +}