| 2397 | r#" |
| 2398 | main: () -> i32 { |
| 2399 | a: f32 = 1.5 |
| 2400 | b: f32 = 2.5 |
| 2401 | c: f32 = a + b |
| 2402 | return c as i32 |
| 2403 | } |
| 2404 | "#, |
| 2405 | ); |
| 2406 | assert!( |
| 2407 | matches!(outcome, RunOutcome::Halted(4)), |
| 2408 | "expected Halted(4), got {outcome:?}" |
| 2409 | ); |
| 2410 | } |
| 2411 | |
| 2412 | #[test] |
| 2413 | fn float_f64_arithmetic_uses_fpu() { |
| 2414 | // Before the fix, f64 math fell through to the integer ALU and operated on |
| 2415 | // raw bit patterns. Correct: 3.5 * 2.0 = 7.0 -> 7. |
| 2416 | let (_, outcome, _) = run_hll( |
| 2417 | r#" |
| 2418 | main: () -> i32 { |
| 2419 | a: f64 = 3.5 |
| 2420 | b: f64 = 2.0 |
| 2421 | c: f64 = a * b |
| 2422 | return c as i32 |