Repository navigation
fix(printf): #871 recognize glibc strtod inf/nan word prefixes in %f/%e/%g - #899
Conversation
…%f/%e/%g GNU printf.def getdouble goes through strtod, which takes the case-insensitive `inf`/`nan` prefix and then the longest valid continuation: `inity` completes `infinity`, and a parenthesised n-char-sequence extends a `nan` subject only when it closes. The subject scan required the whole alpha run to equal inf/infinity/nan, so `infin`/`nann`/`infx`/`nanx` (and `infinite`, `infinityX`, `+nanX`, `inf(2)`, `INF(2)`) converted 0.0 where GNU converts inf/nan -- the diagnostic and rc already matched, only the value diverged. scan_float_subject now takes the prefix rule (byte patterns, no str slicing: multibyte-safe); the paren extension applies to `nan` only, which also repairs the missing `invalid number` on `inf(2)`/`infinity(2)`/`INF(2)`. convert_float_subject is unchanged (starts_with covers the new subjects). Evidence: target/probe/871.sh + 871b.sh byte-match WSL GNU Bash 5.3.15 (stdout; stderr identical modulo script path); new printf_tests/nonfinite_prefix_871.rs 4/4; builtins::printf 56/56; regression 78/78; lib 710 pass + 1 pre-existing env-flaky windows_listing_cache (fails on clean master too).
|
欢迎!这是你的第一个 PR 🎉 请确认已跑过本地测试套件;CI 通过后维护者会 review。 |
|
独立评审结论(@caomengxuan666,#871 / #894 vs #899 双 PR 裁决):验证通过,建议落地本 PR;同票的 #894 建议关闭并致谢(其独有测试素材可顺手并入,见第 4 点)。交叉评审见 #894。 Oracle 复核方法:WSL GNU bash 5.3.0(1)(
落地建议:merge #899(closes #871),#894 关闭并致谢。感谢把 |
Closes #871.
%f/%e/%gnow recognize glibc strtod word prefixes.GNU basis:
printf.defgetdouble goes through strtod, which takes the case-insensitiveinf/nanprefix plus the longest valid continuation (initycompletesinfinity; a closed paren group extendsnan). Only the converted value diverged; rc and diagnostics already matched.scan_float_subjecttakes the prefix rule (byte patterns, multibyte-safe, no str slicing):infin/infxconvertinfwith suffixin/x,nann/nanxconvertnanwith suffixn/x. The paren extension now applies tonanonly, which also repairs the missinginvalid numberoninf(2)/infinity(2)/INF(2).convert_float_subjectunchanged.Evidence:
target/probe/871.sh+871b.shbyte-match WSL GNU Bash 5.3.15; newprintf_tests/nonfinite_prefix_871.rs4/4;builtins::printf56/56;regression78/78;lib710 pass + 1 pre-existing env-flakywindows_listing_cache(fails on clean master too).