Repository navigation
Use C++ decimal punctuation for floating-point output - #106
Open
trestoncuzzort wants to merge 2 commits into
Open
trestoncuzzort wants to merge 2 commits into
trestoncuzzort wants to merge 2 commits into
Conversation
Format float and double with Charconv and translate its decimal point through the active narrow or wide numpunct facet. Normalize printf's C-locale decimal point for extended long double, whose Charconv general precision path is not ready for this use. Integrate the Charconv link dependency into B2, CMake and the module, document manual linking, and add locale round-trip regression coverage. Correct the module test's sample path and link its header-only no-exceptions test to the new dependency. Fixes boostorg#98 Generated-by: OpenAI Codex
Follow the existing test include order so libc++19 does not redeclare standard-library internals after import std. Preserve every locale assertion. Generated-by: OpenAI Codex
trestoncuzzort
marked this pull request as ready for review
October 26, 2026 10:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An unnamed C++
numpunctlocale can makelexical_cast<std::string>(1.25)produce"1.25"whilelexical_cast<double>expects"1#25". The same mismatch affects wide output.Use Boost.Charconv for float/double output and translate the decimal point through the matching C++ facet. Extended long double keeps its existing formatter, with the C decimal point normalized first: Charconv's general-precision path still has the problems discussed in boostorg/charconv#158. This preserves the existing precision, signed-zero and inf/NaN behavior while fixing the locale mismatch for all three types.
This adds a compiled Charconv dependency. B2, CMake, module builds and the standalone no-exceptions test are linked accordingly; manual linking is documented. The module test's existing sample path is also corrected, and the new locale regression runs through both headers and the module.
Fixes #98. The new Charconv link requirement is documented above for review.
Validation:
Full GCC 16 C++11 and Clang 23 C++17 targets pass: 32 checks, including 29 runtime tests, each. Pristine targets pass 31 checks/28 runtime tests; the new outside locale probe fails 18 expectations before the change.
CMake header tests pass 28/28; the corrected standalone C++20 module tests pass 6/6 with Clang and
import stddisabled. The unchanged module's five programs pass in a baseline fixture with corrected source paths.An independent stream oracle checks 111,456 formatting/round-trip results across three floating types, narrow/wide strings, three C locales and three C++ facet configurations. Original: 79,092 mismatches; fixed GCC and Clang ASan/UBSan: zero. Another 74,304 checks with two- and four-byte C decimal separators also pass. These local sanitizer runs instrument the changed headers and oracle, with an uninstrumented static Charconv dependency.
Fork platform matrix: functional tests pass on Linux GCC/Clang, macOS, MinGW and MSVC 32/64. The GCC12 full sanitizer/test step passes; its coverage publishing fails because the wrapper workflow commit is absent from the pinned shallow checkout. The original libc++19 module failure was in the new test's include order; the follow-up Clang19 run passes all module, header and C++20/23 test steps on the current head. No test assertions were removed.
AI assistance: OpenAI Codex. Changes reviewed and tested locally as described above.