Repository navigation
Fix f32 and f64 constant literal generation in cc_bindings_from_rs. - #2372
Open
copybara-service[bot] wants to merge 1 commit into
Open
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
test_999619545
branch
4 times, most recently
from
November 11, 2026 13:43
56650e3 to
c7dd552
Compare
Format finite `f32` and `f64` constants from their raw `ScalarInt` bits using Rust's shortest round-trip debug float formatter (`{value:?}f` and `{value:?}`) instead of `rustc_apfloat` `Display` and `format_float`, which suffixed `f64` (`double`) literals with `L` (`long double`), emitted non-minimal decimal representations, and formatted non-finite values as invalid C++ tokens (`+Inf.0f`, `NaN.0f`). Emit Clang/GCC `constexpr` builtins (`__builtin_inf[f]()` and `__builtin_nan[s][f](...)`) for infinities and NaNs while preserving sign, quiet/signaling bits, and payloads, and remove the `unsupported_consts` workaround for `core::{f32,f64}::{INFINITY,NEG_INFINITY,NAN}`.
PiperOrigin-RevId: 999619545
copybara-service
Bot
force-pushed
the
test_999619545
branch
from
November 11, 2026 14:13
c7dd552 to
a38e5f7
Compare
This branch has not been deployed
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.
Fix f32 and f64 constant literal generation in cc_bindings_from_rs.
Format finite
f32andf64constants from their rawScalarIntbits using Rust's shortest round-trip debug float formatter ({value:?}fand{value:?}) instead ofrustc_apfloatDisplayandformat_float, which suffixedf64(double) literals withL(long double), emitted non-minimal decimal representations, and formatted non-finite values as invalid C++ tokens (+Inf.0f,NaN.0f). Emit Clang/GCCconstexprbuiltins (__builtin_inf[f]()and__builtin_nan[s][f](...)) for infinities and NaNs while preserving sign, quiet/signaling bits, and payloads, and remove theunsupported_constsworkaround forcore::{f32,f64}::{INFINITY,NEG_INFINITY,NAN}.