Skip to content

GPU: round FP16 rectangle corners to even and keep NaN (#245) - #315

Open
towiice wants to merge 1 commit into
fxceless:mainfrom
towiice:fix/rect-fp16-rounding-nan
Open

towiice wants to merge 1 commit into
fxceless:mainfrom
towiice:fix/rect-fp16-rounding-nan

Conversation

@towiice

@towiice towiice commented Nov 24, 2026 •

Copy link
Copy Markdown

Fixes #245. In the CPU rectangle expansion, f32_to_half rounded exact ties up in the normal range and turned NaN into infinity. Ties now go to the even mantissa, as the subnormal path already does, and NaN becomes a quiet NaN with the same sign (the payload is not kept).

Tested (2119b0e + this change; GTX 1650 SUPER, Windows 11, Rust 1.98.1 gnullvm):

  • The new test goes through expand_rects and covers a tie rounding down, a tie rounding up, NaN and ±infinity. It fails without the fix; the NaN check also fails when only the NaN fix is removed.
  • cargo test --workspace --locked --no-fail-fast: 496 passed, 1 failed, 7 ignored. The failure is load_probe: building its fixture fails to link on gnullvm (/DELAYLOAD); this PR does not touch it.
  • Clippy (--all-targets -D warnings) passes, and rustfmt --check passes on the changed file.

Not tested: MSVC build, the all-features Clippy run, running a game.

AI use: written and tested with Claude Code.

🤖 Generated with Claude Code

The CPU rectangle expansion rounded exact ties up and turned NaN into
infinity.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GPU rectangle CPU fallback: FP16 conversion turns NaN into infinity and rounds ties up

1 participant