Summary
math.clamp delegates directly to Rust f64::clamp. Reversed bounds panic the interpreter instead of returning a controlled Jett runtime error; NaN bounds have the same host-panic behavior.
Reproduction
function main() returns nothing:
float64 value = math.clamp(1.0, 2.0, 1.0)
println(value)
cargo run -q -p jett_cli -- run <fixture> exits with Rust panic code 101 (min > max, or either was NaN) on current main.
Scope
- validate floating-point lower/upper bounds before invoking the host
clamp implementation;
- return deterministic Jett runtime errors for reversed bounds and NaN bounds;
- add runtime-failure regressions proving invalid bounds no longer unwind the interpreter;
- preserve valid floating-point clamping behavior.
The public typechecker signature is math.clamp(float64, float64, float64) -> float64; the interpreter also contains an unreachable integer arm, which is outside this narrow fix. This is intentionally separate from #63, which excludes math.clamp pending an explicit invalid-bound/NaN contract.
Acceptance criteria
This was generated by an AI agent (vycdev2). Please verify any changes before merging or applying.
Summary
math.clampdelegates directly to Rustf64::clamp. Reversed bounds panic the interpreter instead of returning a controlled Jett runtime error; NaN bounds have the same host-panic behavior.Reproduction
cargo run -q -p jett_cli -- run <fixture>exits with Rust panic code 101 (min > max, or either was NaN) on currentmain.Scope
clampimplementation;The public typechecker signature is
math.clamp(float64, float64, float64) -> float64; the interpreter also contains an unreachable integer arm, which is outside this narrow fix. This is intentionally separate from #63, which excludesmath.clamppending an explicit invalid-bound/NaN contract.Acceptance criteria
math.clampcases continue to pass.cargo fmt --check,cargo build, andcargo test -qpass.This was generated by an AI agent (vycdev2). Please verify any changes before merging or applying.