Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- { os: ubuntu-24.04, cc: clang, ver: 18, build: Release }
- { os: ubuntu-22.04, cc: gcc, ver: 12, build: Debug, extra: "-DBOUND_CXX20=ON", note: " (C++20)" }
- { os: ubuntu-24.04, cc: gcc, ver: 14, build: Release, extra: "-DBOUND_MATH_FIXED=ON", note: " (CORDIC)", heavy: true }
- { os: ubuntu-24.04, cc: gcc, ver: 14, build: Release, extra: "-DBOUND_MATH_FLOAT=ON", note: " (float)" }
# Native ARM64 (free for public repos): exercises a different ABI/codegen —
# the Release cell runs the fuzz harness as a cross-arch bit-exactness check.
- { os: ubuntu-24.04-arm, cc: gcc, ver: 14, build: Debug, note: " (arm64)" }
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ if(BOUND_MATH_FIXED)
target_compile_definitions(bound_bound INTERFACE BND_MATH_FIXED)
endif()

# -DBOUND_MATH_FLOAT=ON makes the UNQUALIFIED bnd::math::fn use the float
# (binary32) engine — for single-precision-only FPUs. All engines stay reachable
# by namespace (cordic::/dbl::/flt::) regardless; this only picks the default.
# Ignored under BOUND_MATH_FIXED (the integer engine wins / no FP).
option(BOUND_MATH_FLOAT "Default bnd::math to the float (binary32) engine instead of double" OFF)
if(BOUND_MATH_FLOAT)
target_compile_definitions(bound_bound INTERFACE BND_MATH_FLOAT)
endif()

# By default an incompatible assignment/conversion (`b = x;`, `bound{x}`, a by-value
# bound argument) reports the *reason* at compile time via named static_asserts. That
# makes `bound` advertise itself is_constructible/convertible from incompatible types
Expand Down
7 changes: 6 additions & 1 deletion docs/math.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,12 @@ are also reachable by name, **callable side-by-side in the same binary**:
| `bnd::math::cordic::fn` | integer / CORDIC | **always** (constexpr, FPU-free) |
| `bnd::math::dbl::fn` | `double` (binary64) | unless `BND_MATH_NO_FP` |
| `bnd::math::flt::fn` | `float` (binary32) | unless `BND_MATH_NO_FP` |
| `bnd::math::fn` | the default | `cordic` under `BND_MATH_FIXED`/`BND_MATH_NO_FP`, else `dbl` |
| `bnd::math::fn` | the default | `cordic` under `BND_MATH_FIXED`/`BND_MATH_NO_FP`; `flt` under `BND_MATH_FLOAT`; else `dbl` |

Select the unqualified default at build time: `-DBOUND_MATH_FIXED=ON` (integer),
`-DBOUND_MATH_FLOAT=ON` (binary32), or neither (binary64). The macro only changes
what the bare `bnd::math::fn` name means — `cordic::`/`dbl::`/`flt::` stay
individually reachable regardless.

The qualified entry points have the **same signatures, domains, auto-deduced
output grids, and domain `static_assert`s** as the unqualified one — only the
Expand Down
Loading
Loading