Repository navigation
fix(builtins): #871 — printf recognizes glibc inf/nan word prefixes - #894
arookieofc wants to merge 1 commit into
Conversation
…not only the exact words glibc strtod treats `inf`/`infinity`/`nan` as prefixes: a trailing alphabetic run is left to *ep while the leading letters still convert — so `infin`, `infx`, `nann`, `nanx`, `inff`, `nana` all print inf/nan and report the whole operand as an invalid number (chk_converror fires on the unconsumed suffix). The scanner required the exact words `inf`/`infinity`/`nan`, so every letter-suffixed form printed 0.000000. `scan_float_subject` now matches the prefix family: `infinity` as an exact (case-insensitive) whole word, else the `inf`/`nan` prefixes; the subject still ends at the prefix boundary so the trailing letters surface as the *ep suffix diagnostic, byte-identical to GNU. `nan(seq)` keeps its parenthesised-subject rule. Verified vs WSL GNU bash 5.3.9 (the 5.3-series oracle): the full infin/nann/infx/nanx/inf/infinity/nan/INF/INFINITY/NAN/inff/nana/ infinitY/nanx2 matrix prints identically, the `infinit`/`infinitZ` boundary cases report `invalid number` like GNU, and `nan(x)` keeps its parenthesised subject. New regression `nonfinite_word_prefixes_convert`; printf numeric suite 53/53 green.
|
欢迎!这是你的第一个 PR 🎉 请确认已跑过本地测试套件;CI 通过后维护者会 review。 |
|
独立评审结论(@caomengxuan666,interim review for #871 / #894 vs #899):建议落地 #899,本 PR 建议关闭并致谢。 交叉评审见 #899。 Oracle 复核(WSL GNU bash 5.3.0(1),
套件复核:本分支 lib 708/708 绿(含 谢谢这份 PR——#871 的词前缀分析、14 形矩阵与 (另记: |
Closes #871.
glibc strtod treats
inf/infinity/nanas word prefixes: trailing letters are left to*epwhile the prefix converts —infin/infx/nann/nanx/inff/nanaall print inf/nan and report the operand as an invalid number.scan_float_subjectrequired the exact words, so those forms printed0.000000.Now matches the prefix family (
infinityas an exact case-insensitive word, elseinf/nanprefixes), with the subject ending at the prefix boundary so the tail surfaces as the invalid-number diagnostic, byte-identical to GNU.nan(seq)keeps its parenthesised rule.Verified vs WSL GNU bash 5.3.9 (the 5.3-series oracle): the full 14-operand matrix plus the
infinit/infinitZboundary prints identically;infinitYis a case-insensitiveinfinity(no diagnostic), matching GNU. Newnonfinite_word_prefixes_convertregression; printf numeric suite 53/53 green.