folly/Conv: remove double-conversion, replace toAppend<float> with fmt#787
Open
r-barnes wants to merge 1 commit into
Open
folly/Conv: remove double-conversion, replace toAppend<float> with fmt#787r-barnes wants to merge 1 commit into
r-barnes wants to merge 1 commit into
Conversation
Summary:
Removes the last remaining use of Google's double-conversion library from `folly/Conv.h`:
- Removes `DtoaMode`, `DtoaFlags`, their bitwise operators, and the `detail::` helpers (`convert()`, `kConvMaxFixedDigitsAfterPoint`, `kConvMaxPrecisionDigits`, and the range constants). These were only needed to bridge `toAppend(Src, Tgt*, DtoaMode, ...)` to double-conversion; all callers have migrated away (folly/json in the previous diff, thrift/JsonWriter in the diff before this).
- Removes `toAppend(Src, Tgt*, DtoaMode, unsigned, DtoaFlags)` — the parametric overload is now dead.
- Replaces `toAppend(Src value, Tgt* result)` (the simple double-to-string overload) with fmt's Dragonbox. NaN and Infinity preserve the "NaN"/"Infinity"/"-Infinity" spellings. Other values use `fmt::format("{}", ...)`. The output is the shortest round-trip decimal with fmt's exponent threshold; a small number of `testDoubleToString` golden values change accordingly (e.g., "0.000001" → "1e-06", uppercase "E" → lowercase "e") since fmt and double-conversion use different formatting conventions.
- Simplifies `estimateSpaceNeeded<float>` to a constant 24 + sign, removing dependence on the removed detail constants.
- In `fbcode/folly/BUCK`: swaps `exported_external_deps = ["double_conversion"]` for `"fbsource//third-party/fmt:fmt"` in the `:conv` target.
- Removes the `DtoaMode`/`DtoaFlags` ConvTest tests that tested the removed API.
Reviewed By: skrueger
Differential Revision: D106051019
|
@r-barnes has exported this pull request. If you are a Meta employee, you can view the originating Diff in D106051019. |
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.
Summary:
Removes the last remaining use of Google's double-conversion library from
folly/Conv.h:DtoaMode,DtoaFlags, their bitwise operators, and thedetail::helpers (convert(),kConvMaxFixedDigitsAfterPoint,kConvMaxPrecisionDigits, and the range constants). These were only needed to bridgetoAppend(Src, Tgt*, DtoaMode, ...)to double-conversion; all callers have migrated away (folly/json in the previous diff, thrift/JsonWriter in the diff before this).toAppend(Src, Tgt*, DtoaMode, unsigned, DtoaFlags)— the parametric overload is now dead.toAppend(Src value, Tgt* result)(the simple double-to-string overload) with fmt's Dragonbox. NaN and Infinity preserve the "NaN"/"Infinity"/"-Infinity" spellings. Other values usefmt::format("{}", ...). The output is the shortest round-trip decimal with fmt's exponent threshold; a small number oftestDoubleToStringgolden values change accordingly (e.g., "0.000001" → "1e-06", uppercase "E" → lowercase "e") since fmt and double-conversion use different formatting conventions.estimateSpaceNeeded<float>to a constant 24 + sign, removing dependence on the removed detail constants.fbcode/folly/BUCK: swapsexported_external_deps = ["double_conversion"]for"fbsource//third-party/fmt:fmt"in the:convtarget.DtoaMode/DtoaFlagsConvTest tests that tested the removed API.Reviewed By: skrueger
Differential Revision: D106051019