makepad/libs/relax/compiler/tests/t3.rs
Admin b22a714840 makepad run: the Rust JIT (libs/relax) and makepad-remote
The JIT that runs makepad apps from source: lexer, front end, type checker,
lazy borrow checker (Gandalf; `--check-first` opts in), codegen, session and
warm/cold caches keyed by compiler stamp, provided crates bound late,
startup images, live patching. User-facing name is `makepad run` (binary
`makepad`, MAKEPAD_RUN_* env, ~/.makepad-run); libs/relax stays the internal
library name. `makepad check` reports rustc-style diagnostics with rustc
error codes and checks a whole workspace (`--workspace`). Runs on macOS,
Linux, Windows and Android. makepad-remote: one tool schema for apps and the
WM (app/1): grabs, captures, traces, frame profiles and tweaks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 12:26:21 +02:00

23 lines
772 B
Rust

// min/max/mul_add semantics vs rustc
fn mm(a: f64, b: f64) -> (f64, f64) {
(a.min(b), a.max(b))
}
#[test]
fn min_max_nan() {
let nan = f64::NAN;
let cases = [(1.0, 2.0), (2.0, 1.0), (nan, 1.0), (1.0, nan), (-3.5, -3.5), (1e300, -1e300)];
let mut h = 0u64;
for i in 0..cases.len() {
let (a, b) = cases[i];
let (lo, hi) = mm(a, b);
h = (h ^ lo.to_bits()).wrapping_mul(0x100000001b3);
h = (h ^ hi.to_bits()).wrapping_mul(0x100000001b3);
let lf = (a as f32).min(b as f32);
h = (h ^ lf.to_bits() as u64).wrapping_mul(0x100000001b3);
}
println!("minmax hash {:x}", h);
assert!(nan.min(1.0) == 1.0 && 1.0f64.min(nan) == 1.0);
let f = 0.1f64.mul_add(10.0, -1.0);
println!("fma {:e}", f);
}