Skip to content

Deprecate tsl::strings::LegacyPrecision in favor of absl::HighPrecision. - #3666

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_1003771966
Oct 22, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_1003771966

Conversation

@copybara-service

Copy link
Copy Markdown

Deprecate tsl::strings::LegacyPrecision in favor of absl::HighPrecision.

LegacyPrecision(float) and LegacyPrecision(double) now forward to
absl::HighPrecision, and the custom FpToBuffer implementation is removed.

This is a value-preserving but not byte-identical change in formatting:

  • float: the old implementation used %.6g and fell back to %.9g. absl uses
    the shortest of 6-9 significant digits that round-trips, e.g.
    1.17549435e-38f is now printed as "1.1754944e-38". This matches what the
    header comment already documented (%.6g, %.7g, %.8g, or %.9g).
  • double: unchanged (%.15g, falling back to %.17g).
  • NaN with the sign bit set is now printed as "nan" instead of "-nan".

All outputs still round-trip to the exact same value.

@copybara-service
copybara-service Bot force-pushed the test_1003771966 branch 2 times, most recently from 00eeebc to 6f93d5c Compare October 21, 2026 17:36
…ision`.

`LegacyPrecision(float)` and `LegacyPrecision(double)` now forward to
`absl::HighPrecision`, and the custom `FpToBuffer` implementation is removed.

This is a value-preserving but not byte-identical change in formatting:
- float: the old implementation used %.6g and fell back to %.9g. absl uses
  the shortest of 6-9 significant digits that round-trips, e.g.
  1.17549435e-38f is now printed as "1.1754944e-38". This matches what the
  header comment already documented (%.6g, %.7g, %.8g, or %.9g).
- double: unchanged (%.15g, falling back to %.17g).
- NaN with the sign bit set is now printed as "nan" instead of "-nan".

All outputs still round-trip to the exact same value.

PiperOrigin-RevId: 1004642809
@copybara-service
copybara-service Bot merged commit 9d624ab into main Oct 22, 2026
7 checks passed
@copybara-service
copybara-service Bot deleted the test_1003771966 branch October 22, 2026 10:33
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.

1 participant