Skip to content

Fix floating-point infinity literal generation - #1123

Merged
vyazelenko merged 1 commit into
aeron-io:masterfrom
wrayste:infinity-patch
Sep 17, 2026
Merged

vyazelenko merged 1 commit into
aeron-io:masterfrom
wrayste:infinity-patch

Conversation

@wrayste

@wrayste wrayste commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

SBE Tool already accepts positive and negative Infinity values for FLOAT and DOUBLE through PrimitiveValue, but several target generators treat the resulting canonical Infinity / -Infinity strings as ordinary finite literals.

This produces invalid generated source, for example:

  • Java: Infinityf, Infinityd
  • C++/C: Infinityf, Infinity
  • C#: Infinityf, Infinityd
  • Rust: Infinity_f32, Infinity_f64
  • Go: invalid Infinity expressions

This change renders those already accepted values using width- and sign-correct target-language expressions for Java, C++, C, C#, both Go generators, and Rust.

Parsing and IR representation are unchanged, as are finite-value formatting and existing NaN handling.

The change also adds regression coverage for:

  • positive and negative Infinity
  • both FLOAT and DOUBLE
  • constants, explicit null values, and representative min/max paths
  • generated-source compilation and native runtime behavior
  • exact IEEE-754 width/sign representations

Validation included the SBE Tool test suite and Checkstyle, C/C++ builds with GCC and Clang, C# tests, both Go generators, Rust tests, and the full Gradle build.

Comment thread csharp/sbe-tests/InfinityTests.cs Fixed
Comment thread csharp/sbe-tests/InfinityTests.cs Fixed
Comment thread csharp/sbe-tests/InfinityTests.cs Fixed
Comment thread csharp/sbe-tests/InfinityTests.cs Fixed
Comment thread csharp/sbe-tests/InfinityTests.cs Fixed
Comment thread csharp/sbe-tests/InfinityTests.cs Fixed
SBE Tool accepts positive and negative Infinity for FLOAT and DOUBLE,
but several target generators emit invalid source for those values.

Generate width- and sign-correct infinity expressions for Java, C++,
C, C#, Go, and Rust, and add parser, generator, and native regression
coverage.
@vyazelenko
vyazelenko merged commit b456296 into aeron-io:master Sep 17, 2026
34 checks passed
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.

3 participants