Round debug float output to 4 decimal places#55879
Closed
NickGerleman wants to merge 1 commit intofacebook:mainfrom
Closed
Round debug float output to 4 decimal places#55879NickGerleman wants to merge 1 commit intofacebook:mainfrom
NickGerleman wants to merge 1 commit intofacebook:mainfrom
Conversation
|
@NickGerleman has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95041966. |
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Mar 6, 2026
Summary:
Float values in debug layout metrics output (used by Fantom test assertions) are
subject to floating-point precision differences across platforms and compilers
(e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons.
This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format
floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros,
replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded
by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all
consumers.
The `double-conversion` dependency is also removed from the BUCK file since it is
no longer used.
Output examples:
- `0.0` → `"0"`
- `100.0` → `"100"`
- `66.66666412353516` → `"66.6667"`
- `1.5` → `"1.5"`
- `33.333333` → `"33.3333"`
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D95041966
298b483 to
ff34c65
Compare
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Mar 6, 2026
Summary:
Float values in debug layout metrics output (used by Fantom test assertions) are
subject to floating-point precision differences across platforms and compilers
(e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons.
This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format
floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros,
replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded
by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all
consumers.
The `double-conversion` dependency is also removed from the BUCK file since it is
no longer used.
Output examples:
- `0.0` → `"0"`
- `100.0` → `"100"`
- `66.66666412353516` → `"66.6667"`
- `1.5` → `"1.5"`
- `33.333333` → `"33.3333"`
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D95041966
ff34c65 to
3d83ddf
Compare
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Mar 6, 2026
Summary: Pull Request resolved: facebook#55879 Float values in debug layout metrics output (used by Fantom test assertions) are subject to floating-point precision differences across platforms and compilers (e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons. This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros, replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all consumers. The `double-conversion` dependency is also removed from the BUCK file since it is no longer used. Output examples: - `0.0` → `"0"` - `100.0` → `"100"` - `66.66666412353516` → `"66.6667"` - `1.5` → `"1.5"` - `33.333333` → `"33.3333"` Changelog: [Internal] Reviewed By: javache Differential Revision: D95041966
3d83ddf to
497d69f
Compare
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Mar 6, 2026
Summary:
Float values in debug layout metrics output (used by Fantom test assertions) are
subject to floating-point precision differences across platforms and compilers
(e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons.
This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format
floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros,
replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded
by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all
consumers.
The `double-conversion` dependency is also removed from the BUCK file since it is
no longer used.
Output examples:
- `0.0` → `"0"`
- `100.0` → `"100"`
- `66.66666412353516` → `"66.6667"`
- `1.5` → `"1.5"`
- `33.333333` → `"33.3333"`
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D95041966
c863c2f to
7ade935
Compare
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Mar 6, 2026
Summary:
Float values in debug layout metrics output (used by Fantom test assertions) are
subject to floating-point precision differences across platforms and compilers
(e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons.
This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format
floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros,
replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded
by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all
consumers.
The `double-conversion` dependency is also removed from the BUCK file since it is
no longer used.
Output examples:
- `0.0` → `"0"`
- `100.0` → `"100"`
- `66.66666412353516` → `"66.6667"`
- `1.5` → `"1.5"`
- `33.333333` → `"33.3333"`
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D95041966
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Mar 6, 2026
Summary:
Float values in debug layout metrics output (used by Fantom test assertions) are
subject to floating-point precision differences across platforms and compilers
(e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons.
This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format
floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros,
replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded
by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all
consumers.
The `double-conversion` dependency is also removed from the BUCK file since it is
no longer used.
Output examples:
- `0.0` → `"0"`
- `100.0` → `"100"`
- `66.66666412353516` → `"66.6667"`
- `1.5` → `"1.5"`
- `33.333333` → `"33.3333"`
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D95041966
7ade935 to
554b351
Compare
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Mar 6, 2026
Summary:
Float values in debug layout metrics output (used by Fantom test assertions) are
subject to floating-point precision differences across platforms and compilers
(e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons.
This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format
floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros,
replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded
by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all
consumers.
The `double-conversion` dependency is also removed from the BUCK file since it is
no longer used.
Output examples:
- `0.0` → `"0"`
- `100.0` → `"100"`
- `66.66666412353516` → `"66.6667"`
- `1.5` → `"1.5"`
- `33.333333` → `"33.3333"`
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D95041966
554b351 to
2413c0a
Compare
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Mar 6, 2026
Summary: Pull Request resolved: facebook#55879 Float values in debug layout metrics output (used by Fantom test assertions) are subject to floating-point precision differences across platforms and compilers (e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons. This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros, replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all consumers. The `double-conversion` dependency is also removed from the BUCK file since it is no longer used. Output examples: - `0.0` → `"0"` - `100.0` → `"100"` - `66.66666412353516` → `"66.6667"` - `1.5` → `"1.5"` - `33.333333` → `"33.3333"` Changelog: [Internal] Reviewed By: javache Differential Revision: D95041966
2413c0a to
217c02a
Compare
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Mar 6, 2026
Summary:
Float values in debug layout metrics output (used by Fantom test assertions) are
subject to floating-point precision differences across platforms and compilers
(e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons.
This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format
floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros,
replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded
by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all
consumers.
The `double-conversion` dependency is also removed from the BUCK file since it is
no longer used.
Output examples:
- `0.0` → `"0"`
- `100.0` → `"100"`
- `66.66666412353516` → `"66.6667"`
- `1.5` → `"1.5"`
- `33.333333` → `"33.3333"`
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D95041966
217c02a to
155233c
Compare
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Mar 6, 2026
Summary:
Float values in debug layout metrics output (used by Fantom test assertions) are
subject to floating-point precision differences across platforms and compilers
(e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons.
This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format
floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros,
replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded
by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all
consumers.
The `double-conversion` dependency is also removed from the BUCK file since it is
no longer used.
Output examples:
- `0.0` → `"0"`
- `100.0` → `"100"`
- `66.66666412353516` → `"66.6667"`
- `1.5` → `"1.5"`
- `33.333333` → `"33.3333"`
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D95041966
155233c to
8cf5a0d
Compare
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Mar 6, 2026
Summary: Pull Request resolved: facebook#55879 Float values in debug layout metrics output (used by Fantom test assertions) are subject to floating-point precision differences across platforms and compilers (e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons. This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros, replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all consumers. The `double-conversion` dependency is also removed from the BUCK file since it is no longer used. Output examples: - `0.0` → `"0"` - `100.0` → `"100"` - `66.66666412353516` → `"66.6667"` - `1.5` → `"1.5"` - `33.333333` → `"33.3333"` Changelog: [Internal] Reviewed By: javache Differential Revision: D95041966
8cf5a0d to
c73c2c4
Compare
Summary:
Float values in debug layout metrics output (used by Fantom test assertions) are
subject to floating-point precision differences across platforms and compilers
(e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons.
This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format
floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros,
replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded
by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all
consumers.
The `double-conversion` dependency is also removed from the BUCK file since it is
no longer used.
Output examples:
- `0.0` → `"0"`
- `100.0` → `"100"`
- `66.66666412353516` → `"66.6667"`
- `1.5` → `"1.5"`
- `33.333333` → `"33.3333"`
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D95041966
c73c2c4 to
0a54771
Compare
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Mar 6, 2026
Summary:
Float values in debug layout metrics output (used by Fantom test assertions) are
subject to floating-point precision differences across platforms and compilers
(e.g., `66.6667` vs `66.66666412353516`), causing flaky test comparisons.
This changes `toString(const double&)` in `DebugStringConvertible.cpp` to format
floats with 4 decimal places using `snprintf("%.4f")` and strip trailing zeros,
replacing `double-conversion`'s `ToShortest()`. This is debug-only code (guarded
by `#if RN_DEBUG_STRING_CONVERTIBLE`) so the precision change is safe for all
consumers.
The `double-conversion` dependency is also removed from the BUCK file since it is
no longer used.
Output examples:
- `0.0` → `"0"`
- `100.0` → `"100"`
- `66.66666412353516` → `"66.6667"`
- `1.5` → `"1.5"`
- `33.333333` → `"33.3333"`
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D95041966
Collaborator
|
This pull request was successfully merged by @NickGerleman in 3483dfa When will my fix make it into a release? | How to file a pick request? |
|
This pull request has been merged in 3483dfa. |
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:
Float values in debug layout metrics output (used by Fantom test assertions) are
subject to floating-point precision differences across platforms and compilers
(e.g.,
66.6667vs66.66666412353516), causing flaky test comparisons.This changes
toString(const double&)inDebugStringConvertible.cppto formatfloats with 4 decimal places using
snprintf("%.4f")and strip trailing zeros,replacing
double-conversion'sToShortest(). This is debug-only code (guardedby
#if RN_DEBUG_STRING_CONVERTIBLE) so the precision change is safe for allconsumers.
The
double-conversiondependency is also removed from the BUCK file since it isno longer used.
Output examples:
0.0→"0"100.0→"100"66.66666412353516→"66.6667"1.5→"1.5"33.333333→"33.3333"Changelog: [Internal]
Reviewed By: javache
Differential Revision: D95041966