Skip to content

Build strict: -ffp-contract=off replaces -ffast-math on every target - #54

Merged
rowan-claude merged 2 commits into
mainfrom
fp-contract-off
Aug 25, 2026
Merged

Build strict: -ffp-contract=off replaces -ffast-math on every target#54
rowan-claude merged 2 commits into
mainfrom
fp-contract-off

Conversation

@rowan-claude

Copy link
Copy Markdown
Contributor

Enacts Glenn's standing estate policy (2026-08-24): "generally speaking, network libraries we work on require -ffp-contract=off." serialize sets and documents the flag; yojimbo came under the policy in mas-bandwidth/yojimbo#333; netcode's equivalent is mas-bandwidth/netcode#179. This brings reliable under it.

CMakeLists.txt replaces the global -ffast-math (GCC/Clang) and /fp:fast (MSVC) with -ffp-contract=off and /fp:precise. Global add_compile_options, so every target — library, test, example, soak, stats, fuzz harnesses — builds strict, and since CI drives every leg through this file, CI now enforces the flag on all platforms. BUILDING.md gains a floating point section mirroring yojimbo's, stating the flags and the consumer requirement.

Honesty about scope: reliable's wire format carries no floating point — the floats in reliable.c are the RTT, jitter, packet loss and bandwidth stats. So this is the policy's floor, not a wire fix; nothing measured wrong here today, and the docs say exactly that rather than claiming a mechanism this repo does not have. The floor exists because FMA is in the aarch64 baseline and absent from the x86-64 one, so any float arithmetic that ever nears the wire diverges bit-wise between architectures unless the family builds strict.

The fast-math flags date from the premake era; serialize made the same replacement, and on MSVC there is no fast-minus-contraction spelling at all, so strict-replaces-fast is the only shape consistent across compilers.

Verified on this bench (arm64 mac, AppleClang, Release): build green, all 4 ctest suites pass (test, fuzz, soak, fuzz_target), -ffp-contract=off confirmed on the actual compile lines of reliable.c and test.cpp via cmake --build --verbose, zero remaining ffast-math occurrences in the build output.

🤖 Generated with Claude Code

rowan-claude and others added 2 commits August 25, 2026 16:19
Enacts the estate policy for mas-bandwidth network libraries (Glenn,
2026-08-24): network libraries build with -ffp-contract=off on GCC/Clang
and /fp:precise on MSVC. reliable carried -ffast-math / /fp:fast; those
are gone. reliable's wire format carries no floating point -- the floats
are RTT/jitter/loss/bandwidth stats -- so this is the family floor
rather than a wire fix, and BUILDING.md says exactly that to consumers.
CI builds through CMakeLists.txt, so every CI leg now builds strict.

Verified on this bench: Release build green, all 4 ctest suites pass
(test, fuzz, soak, fuzz_target), the flag confirmed on the actual
compile lines of reliable.c and test.cpp (--verbose), zero remaining
-ffast-math occurrences.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The first CI run of the strict build failed to link every C executable
on Linux: reliable.c:1493 calls pow() for the jitter stddev, and
-ffast-math had been rewriting pow(x, 0.5f) into inline sqrt, so the
library never needed libm and never linked it. Strict math keeps the
call. Link m PUBLIC where it exists (Linux glibc; mac and Windows carry
the math functions in the base runtime), and declare -lm in
Libs.private for static pkg-config consumers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@rowan-claude
rowan-claude merged commit b5fd3d5 into main Aug 25, 2026
11 checks passed
@rowan-claude
rowan-claude deleted the fp-contract-off branch August 25, 2026 06:24
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.

1 participant