Skip to content

StrFormat: honor zero padding in slow scientific conversions - #2195

Closed
vera-rubin wants to merge 1 commit into
abseil:masterfrom
vera-rubin:fix/scientific-zero-padding
Closed

vera-rubin wants to merge 1 commit into
abseil:masterfrom
vera-rubin:fix/scientific-zero-padding

Conversation

@vera-rubin

Copy link
Copy Markdown
Contributor

Slow scientific %e and %g conversions dropped zero padding: %010.0e and %010.1g returned 3e+38 instead of 000003e+38 for 0x1p128.

Both emitters now append the computed zeros after any sign.

The regression covers both exponent signs, positive and negative values, lowercase and uppercase conversions, sign flags, and alternate form. It fails before and passes after the fix. All eight existing str_format test targets pass in both runs with GCC 13.3, C++17, and CMake Release.

Fixes #2194

— ChipLab

@mkruskal-google mkruskal-google self-assigned this Oct 14, 2026
copybara-service Bot pushed a commit that referenced this pull request Oct 19, 2026
Imported from GitHub PR #2195

Slow scientific `%e` and `%g` conversions dropped zero padding: `%010.0e` and `%010.1g` returned `3e+38` instead of `000003e+38` for `0x1p128`.

Both emitters now append the computed zeros after any sign.

The regression covers both exponent signs, positive and negative values, lowercase and uppercase conversions, sign flags, and alternate form. It fails before and passes after the fix. All eight existing str_format test targets pass in both runs with GCC 13.3, C++17, and CMake Release.

Fixes #2194

Merge 7429268 into d522178

Merging this change closes #2195

PiperOrigin-RevId: 999151724
copybara-service Bot pushed a commit that referenced this pull request Oct 19, 2026
Imported from GitHub PR #2195

Slow scientific `%e` and `%g` conversions dropped zero padding: `%010.0e` and `%010.1g` returned `3e+38` instead of `000003e+38` for `0x1p128`.

Both emitters now append the computed zeros after any sign.

The regression covers both exponent signs, positive and negative values, lowercase and uppercase conversions, sign flags, and alternate form. It fails before and passes after the fix. All eight existing str_format test targets pass in both runs with GCC 13.3, C++17, and CMake Release.

Fixes #2194

Merge 7429268 into d522178

Merging this change closes #2195

PiperOrigin-RevId: 999151724
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.

[Bug]: StrFormat omits zero padding in slow scientific %e and %g conversions

2 participants