Skip to content

folly/Conv: remove double-conversion, replace toAppend<float> with fmt#787

Open
r-barnes wants to merge 1 commit into
facebook:devfrom
r-barnes:export-D106051019
Open

folly/Conv: remove double-conversion, replace toAppend<float> with fmt#787
r-barnes wants to merge 1 commit into
facebook:devfrom
r-barnes:export-D106051019

Conversation

@r-barnes

Copy link
Copy Markdown
Contributor

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

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
@meta-cla meta-cla Bot added the cla signed label May 27, 2026
@meta-codesync

meta-codesync Bot commented May 27, 2026

Copy link
Copy Markdown

@r-barnes has exported this pull request. If you are a Meta employee, you can view the originating Diff in D106051019.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant