ucrt: set ERANGE when strtod underflows to zero #72
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!72
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-72"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Olima34 on GitHub · 2026-11-26 13:41 UTC · original
Olima34:fix/ucrt-strtod-underflow-erange→main· +37 −2 · 2 files · 2 commits · merged 2026-11-26 15:53 UTCWhat this changes
Microsoft's
strtod"returns 0 if no conversion can be performed or an underflow occurs" and "errno is set to ERANGE if overflow or underflow occurs". We setERANGEonly on overflow. Nonzero digits that read as 0 (1e-400,strtof's1e-50) now set it too; zero digits (0e-400) and subnormals (4.9e-324) do not.scanf's floats, which already setERANGEon an overflow through the same parser, follow.New test
an_underflow_to_zero_sets_erange.How it was tested
cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory(all pass, native probe tests included)cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings, also with--all-features; clippy forx86_64-apple-darwinreports nothing in the files touched (host_posixis not built for Windows)cargo test --workspaceandcargo xtask policymainand passes with the changeChecklist
VICTORY_*variable and documented (none added)@LakshanSivakumar on GitHub · 2026-11-26 14:55 UTC · original · approved these changes
ERANGE on underflow to zero matches the CRT docs, and zero digits / subnormals correctly leave it alone. Thanks.