Skip to content

Fix shortest round-trip floating-point stringification - #3208

Open
sb123sb123 wants to merge 2 commits into
catchorg:develfrom
sb123sb123:fix/3197-shortest-float-stringification
Open

sb123sb123 wants to merge 2 commits into
catchorg:develfrom
sb123sb123:fix/3197-shortest-float-stringification

Conversation

@sb123sb123

@sb123sb123 sb123sb123 commented Sep 28, 2026 •

Copy link
Copy Markdown

Fixes #3197.

The default floating-point stringifier currently emits fixed notation with max_digits10 digits after the decimal point, which can make nearby double values indistinguishable in failure messages. For the default round-trip precision, this change uses defaultfloat and selects the first significant-digit precision that round-trips, preserving the sign of zero. Non-default precision values retain the existing fixed-format behavior, and infinities are handled separately.

Adds a regression test for the adjacent values 5.000000000000001e-05 and 5e-05, and updates the affected approval baselines.

Validation: MSVC 19.43 x64 Release build of SelfTest; CTest passed 82/82 tests, including approval tests. clang-format passed on the changed C++ hunks.

@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.94737% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.11%. Comparing base (222e233) to head (e754f31).

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #3208      +/-   ##
==========================================
- Coverage   91.17%   91.11%   -0.06%     
==========================================
  Files         206      206              
  Lines        9080     9099      +19     
==========================================
+ Hits         8278     8290      +12     
- Misses        802      809       +7     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sb123sb123

Copy link
Copy Markdown
Author

AppVeyor build 5688’s only failed job is the VS 2017 Release Coverage job. Its log shows all 81 CTest MemCheck tests passed, then the job exited 1 because codecov was not recognized; the other four AppVeyor jobs passed. This looks like a coverage-uploader/environment failure after the tests, not a test failure. Could this check be retried or the uploader step be handled for this PR? AppVeyor log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Floating point printing should print shortest round-trip value

1 participant