From 0484c02517db4b0382ba5fef021a76afc70c63cd Mon Sep 17 00:00:00 2001 From: Bulat Fatykh <68301540+gitoutofthere@users.noreply.github.com> Date: Thu, 1 Oct 2026 01:28:56 +0300 Subject: [PATCH] Turn a non-finite GSC number into a script error, not a panic, when it meets text Co-Authored-By: Claude Opus 5.5 --- crates/sim/src/script/runtime/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/sim/src/script/runtime/mod.rs b/crates/sim/src/script/runtime/mod.rs index 910e4e6..e976479 100644 --- a/crates/sim/src/script/runtime/mod.rs +++ b/crates/sim/src/script/runtime/mod.rs @@ -369,8 +369,9 @@ fn format_g(value: f64) -> String { pub(super) fn to_text(value: &Value) -> Option { match value { Value::Int(n) => Some(n.to_string()), - Value::Float(n) => Some(format_g(f64::from(*n))), - Value::Vector(v) => Some(format!( + // format_g needs the exponent that NaN and infinity print without. + Value::Float(n) if n.is_finite() => Some(format_g(f64::from(*n))), + Value::Vector(v) if v.iter().all(|n| n.is_finite()) => Some(format!( "({}, {}, {})", format_g(f64::from(v[0])), format_g(f64::from(v[1])),