Skip to content

math: BND_MATH_FLOAT selects the float engine as the default#8

Merged
NiceAndPeter merged 1 commit into
mainfrom
math-float-default
Jun 22, 2026
Merged

math: BND_MATH_FLOAT selects the float engine as the default#8
NiceAndPeter merged 1 commit into
mainfrom
math-float-default

Conversation

@NiceAndPeter

Copy link
Copy Markdown
Owner

Phase 4b (part 1) — BND_MATH_FLOAT default selection

Completes the engine-selection story from PR #7. The unqualified bnd::math::fn now has a three-way default:

Build unqualified bnd::math::fn
BND_MATH_FIXED / BND_MATH_NO_FP cordic
BND_MATH_FLOAT flt (binary32)
(neither) dbl (binary64)

cordic:: / dbl:: / flt:: remain individually reachable regardless — the macro only changes what the bare name means.

Changes

  • The 21 public transcendentals + the 3 circle/degree forms gained an #elif defined(BND_MATH_FLOAT) branch routing to the float cores (flt::*_core / flt::detail::d_* / flt::store), mirroring the existing dbl path.
  • CMake -DBOUND_MATH_FLOAT=ONBND_MATH_FLOAT (ignored under FIXED). New CI cell: linux gcc Release (float).
  • Conversion fix: static_cast<float>(bound) is invalid/ambiguous (bounds expose operator double, not float), so bound/rational→float inputs go through double — static_cast<float>(static_cast<double>(x)), exact and deterministic. (Base is imax → direct cast.)
  • test_determinism's golden pins are the default engine's values; the float engine is a third value set, so those cases are scoped #ifndef BND_MATH_FLOAT (float determinism is pinned in test_math_engines). The default-alias test gained a BND_MATH_FLOAT branch.

Verification

default 404/404, CORDIC 442/442, FLOAT 395/395 (determinism cases compile out under float, covered by the float golden pins).

Deferred to the final Phase-4 PR: the f32 storage flag + realf64 rename.

🤖 Generated with Claude Code

Completes the engine-selection story: the unqualified bnd::math::fn now has a
THREE-way default — cordic under BND_MATH_FIXED/BND_MATH_NO_FP, flt under
BND_MATH_FLOAT, else dbl. (cordic::/dbl::/flt:: stay individually reachable
regardless; the macro only picks what the bare name means.)

- The 21 public transcendentals + the 3 circle/degree forms gained an
  `#elif defined(BND_MATH_FLOAT)` branch routing to the float cores
  (flt::*_core / flt::detail::d_* / flt::store), mirroring the existing dbl path.
- CMake: -DBOUND_MATH_FLOAT=ON → BND_MATH_FLOAT (ignored under FIXED). New CI
  cell: linux gcc Release (float).
- Conversion fix: `static_cast<float>(bound)` is invalid/ambiguous (bounds expose
  operator double, not float), so all bound/rational→float inputs go through
  double first — `static_cast<float>(static_cast<double>(x))`, exact and
  deterministic. (Base is imax → stays a direct float cast.)
- test_determinism's golden pins are the DEFAULT engine's values; the float
  engine is a third value set, so those cases are scoped `#ifndef BND_MATH_FLOAT`
  (float determinism is pinned in test_math_engines). The default-alias test
  gained a BND_MATH_FLOAT branch.

Verified: default 404/404, CORDIC 442/442, FLOAT 395/395.

Deferred to the next PR (Phase 4b-ii): the f32 storage flag + real->f64 rename.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@NiceAndPeter NiceAndPeter merged commit 1d1fcc5 into main Jun 22, 2026
17 checks passed
@NiceAndPeter NiceAndPeter deleted the math-float-default branch June 22, 2026 19:07
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