Repository navigation
Conversation
timosachsenberg
left a comment
There was a problem hiding this comment.
The approach looks right: removing the #ifdef is needed now that parseFloat calls fromCharsFloat on non-libc++ builds, and the fallback only runs on the error path. I reproduced the bug against GCC 11's libstdc++ runtime. Its strtod-based from_chars returns result_out_of_range for 1e-40 (float), 2.17388884170148e-321 and 4.9e-324. GCC 12+ accepts them, which is why CI (Ubuntu 24.04, macOS, MSVC) never saw it. Since OPENMS_MIN_GCC is 13, the affected setup is presumably Clang on an older system libstdc++ (Ubuntu 22.04, RHEL 9). Which image was this?
Before merge:
- Values too small for a subnormal now parse as 0 on all platforms. libstdc++ (GCC 13 too) returns
result_out_of_rangefor e.g.1e-400(double) or1e-50(float). The fallback acceptsERANGEwhenever the result is not inf, sotoDouble("1e-400")changes from throwingConversionErrorto returning0.0on Linux/Windows. That matches what libc++ already did, so it may be fine, but please state it and add a test, or rejectERANGE && value == 0if you want the old behavior. FuzzyStringComparator.cpp(lines 125-220) is not updated. It holds a verbatim copy of these helpers with a "keep the two in sync" note, and still has the_LIBCPP_VERSION-only fallback. On the affected toolchain FuzzyDiff still won't parse subnormals as numbers, and the library and FuzzyDiff now disagree on underflow tokens.- Some comments are now stale:
- "All other standard libraries … use std::from_chars directly" (~L180)
- "dispatching to std::from_chars or the libc++ fallback"
- "std::from_chars only reports result_out_of_range on overflow", which is false for libstdc++
Generated by Claude Code
timosachsenberg
left a comment
There was a problem hiding this comment.
Follow-up review of bb10ef29473f, confirming the two behavioral concerns in the earlier review.
A focused executable using the changed StringUtils implementation produced:
toDouble("1e-400") -> 0
toDouble("1e400") -> exception
toDouble("2.17388884170148e-321") -> 2.17389e-321
FuzzyStringComparator.compareStrings("1e-400", "0") -> false
- [P2] Parser synchronization:
StringUtils.cpp:260–264now retries out-of-range tokens, whilesrc/testframework/source/CONCEPT/FuzzyStringComparator.cpp:215–220still callsstd::from_charsdirectly outside libc++. Its "keep the two in sync" contract is therefore broken, and the old-library subnormal problem remains in that path. The local probe above also demonstrates disagreement on an underflow token. - Underflow policy:
1e-400is not a representable subnormal. Returning zero may be intentional, but it broadens behavior beyond the PR title. Either reject underflow-to-zero or document and test its acceptance explicitly.
@poshul, can you confirm whether these are real issues to address here? Specifically, is accepting underflow-to-zero intentional, and should the FuzzyDiff parser be updated in this PR to maintain the shared numeric-token contract?
Validation was a focused build using existing supporting OpenMS libraries. The affected older libstdc++ runtime was not rerun in this follow-up; that part follows from the unchanged parser path and the earlier review's reproduction.
Review performed with Codex.
|
Addressed in 34f1273. Underflow to signed zero is intentional and is now documented and tested for float, double and token extraction. FuzzyStringComparator uses the same C-locale fallback, token grammar and overflow rejection. Seven class/TOPP checks pass. The affected image is localhost/nase-validation:2026-10-11, exact ID 8570b6aa3b6dd817ba45c067dc9c62f0916afb317d80cd89ddc49c1555599314, based on manylinux_2_34_x86_64 / AlmaLinux 9.7. The compiler is GCC 14.2.1 (20250110, Red Hat 14.2.1-12), glibc 2.34; the probe loads /lib64/libstdc++.so.6. A standalone std::from_chars probe in that image returns result_out_of_range for both float 1e-40 and double 2.17388884170148e-321. |
|
one thing to consider: |
|
So my gut feeling is that something that small almost certainly *should*
have been 0, and some floating point BS happened somewhere. So I think in
terms of real data this is the correct approach. In terms of the strange
side effect... I think we'd just need to make sure we are consistant. Do
you think its worth reviewing the rest of our codebase to see how this
should be handled?
…On Monday, October 12, 2026, Timo Sachsenberg ***@***.***> wrote:
*timosachsenberg* left a comment (OpenMS/OpenMS#10534)
<#10534 (comment)>
one thing to consider:
comparison against small integers are exact with floating point values.
So it could cause strange side effects when something was != 0 before and
becomes 0 now.
just a gut feeling ;)
—
Reply to this email directly, view it on GitHub
<#10534?email_source=notifications&email_token=AABD3CZLNQT7JXD4XFSXSR35TSU4JA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMMJSGIYDKNJRGY32M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-6122055167>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABD3C44LXA3MVQQEBVXGQ35TSU4JAVCNFSNUABEKJSXA33TNF2G64TZHMYTKNZWGM2DAMZ3JFZXG5LFHM2TQMBVGU2TCNBQG6QXMAQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
I guess it is fine. Just to keep in mind in case some strange bugs show up... |
|
maybe @cbielow has some opinion here |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to No actionable issue remains in the supplied review evidence; the change is mergeable after normal checks. Pre-merge checks |
|
Pull request was closed
|
a IMHO better alternative is to track down the code producing the subnormals and get rid of them. i.e. |
|
Thanks! |
Representable subnormal numbers such as
1e-40and2.17388884170148e-321can be rejected by a standard library's floating-pointstd::from_charsimplementation. This breaks StringUtils conversion and MRMFeatureSelector inputs on affected toolchains.Reuse the existing locale-independent C parser when
from_charsreports an out-of-range value. Finite subnormal results are accepted; overflow is still rejected. The existing libc++ fallback and ordinary conversions keep their behavior.Validation: rebuilt the library and existing StringUtils/MRMFeatureSelector class tests in the Linux validation image; both pass. Both failed before this change on the same toolchain. Existing StringUtils tests already cover the affected float and double values, so no test files or targets are added.
This is a separate correctness prerequisite found while checking the staged NASE feature stack. It targets
developdirectly and contains only the previously validated portability fix from the preserved integration.Final combined-stack verification with the independent subnormal parsing fix #10534: 2971 configured CTest cases passed (5 skipped), and 6647 Python cases passed (30 skipped). Linux Release configuration; optional GUI, ThermoRaw and opentims were disabled. These totals apply to the combined stack, alongside the per-topic checks above.
Summary by CodeRabbit
Bug Fixes
Documentation