base: Fix double truncation in DynamicStringWriter and FixedStringWriter#5438
Open
backes wants to merge 3 commits intogoogle:mainfrom
Open
base: Fix double truncation in DynamicStringWriter and FixedStringWriter#5438backes wants to merge 3 commits intogoogle:mainfrom
backes wants to merge 3 commits intogoogle:mainfrom
Conversation
When formatting large doubles like 1e100, %lf produces a fixed-point representation that can be very long. In DynamicStringWriter, this was truncated to 31 characters because of the 32-byte fixed buffer in StackString. This CL changes the format from %lf to %.16g, which uses scientific notation for large and small exponents, ensuring it fits in the fixed buffer and preserving double precision. This fixes an issue where V8's JsonIntegrationTest was failing when using Perfetto's JSON exporter. Bug: 382242434
LalitMaganti
approved these changes
Apr 13, 2026
Author
|
Thanks for the quick review! Feel free to merge, I don't have permissions! |
sashwinbalaji
approved these changes
Apr 13, 2026
LalitMaganti
approved these changes
Apr 13, 2026
Member
|
Seems like there's a UI test failure. |
Author
Author
|
I see that the screenshot itself is not checked in, there's just a sha256 hash in |
auto-merge was automatically disabled
April 13, 2026 14:52
Head branch was pushed to by a user without write access
Author
|
Found Should work now. |
Author
|
Merge conflict :/ |
Member
|
tools/run-integrationtests --rebaseline |
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.


When formatting large doubles like 1e100, %lf produces a fixed-point representation that can be very long. In DynamicStringWriter, this was truncated to 31 characters because of the 32-byte fixed buffer in StackString.
This CL changes the format from %lf to %.16g, which uses scientific notation for large and small exponents, ensuring it fits in the fixed buffer and preserving double precision.
This fixes an issue where V8's JsonIntegrationTest was failing when using Perfetto's JSON exporter (see https://crrev.com/c/7748468).
Bug: b/502067293