GPU: preserve NaN and round normal ties to even in primitive::f32_to_half #335

Closed
towiice wants to merge 1 commit from upstream-pr/335 into main
towiice commented 2026-11-24 23:34:57 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by towiice on 2026-11-24T23:34:57Z.


Summary

Fixes #245.

In \crates/victory-gpu/src/primitive.rs, \ 32_to_half\ previously checked \if exp >= 31 { return sign | 0x7c00; }\ without distinguishing an incoming \NaN\ (
aw_exp == 0xff && man != 0) from overflow/infinity, turning any \NaN\ produced during \F16\ rectangle corner expansion (\ 0 + v2 - v1, e.g. \inf - inf\ or an \

<!-- greyfinch-sync:fxceless/victory-fork:issue:6593600356 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/335). Originally posted by [towiice](https://github.com/towiice) on 2026-11-24T23:34:57Z. --- ### Summary Fixes #245. In \crates/victory-gpu/src/primitive.rs\, \ 32_to_half\ previously checked \if exp >= 31 { return sign | 0x7c00; }\ without distinguishing an incoming \NaN\ (\ aw_exp == 0xff && man != 0\) from overflow/infinity, turning any \NaN\ produced during \F16\ rectangle corner expansion (\ 0 + v2 - v1\, e.g. \inf - inf\ or an \
upstream-sync closed this pull request 2026-11-25 01:11:27 +00:00
towiice commented 2026-11-25 01:12:02 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by towiice on 2026-11-25T00:36:58Z.


Closing: this duplicates my earlier #315 for #245, which I opened first and which has the fuller test and description. Sorry for the noise.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7148697829 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/335#issuecomment-7148697829). Originally posted by [towiice](https://github.com/towiice) on 2026-11-25T00:36:58Z. --- Closing: this duplicates my earlier #315 for #245, which I opened first and which has the fuller test and description. Sorry for the noise.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!335
No description provided.