Skip to content

Conversation

@copybara-service
Copy link

Improve our handling of floats and float constants.

This CL makes two changes:

  • Rename generated C++ constants from SCREAMING_SNAKE_CASE to kUpperCamelCase.
  • Map rust infinity and nan to their std::numeric_limits counterparts.

Previously, we mapped Rust infinity to Inff and NAN to Nanf which are not valid C++
values. The C++ constant rename gets around a name collision with
existing C++ macros INFINITY and NAN. Because these are macros we
can't avoid the collision, so we work around it with the rename.

This CL makes two changes:

* Rename generated C++ constants from SCREAMING_SNAKE_CASE to kUpperCamelCase.
* Map rust infinity and nan to their std::numeric_limits counterparts.

Previously, we mapped Rust infinity to `Inff` and NAN to `Nanf` which are not valid C++
values. The C++ constant rename gets around a name collision with
existing C++ macros `INFINITY` and `NAN`. Because these are macros we
can't avoid the collision, so we work around it with the rename.

PiperOrigin-RevId: 827657369
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.

2 participants