Skip to content

feat(core): add SineTable and shared interpolating table read - #125

Merged
maxwellmattryan merged 1 commit into
developfrom
feat/sine-table
Sep 11, 2026
Merged

maxwellmattryan merged 1 commit into
developfrom
feat/sine-table

Conversation

@maxwellmattryan

Copy link
Copy Markdown
Contributor

Summary

Phantom build guide step 03.

  • bbx_core::table::read_interpolated<const LENGTH>(&[f32; LENGTH], phase): floor-wrapped, index-clamped linear interpolation over LENGTH - 1 cells plus a guard entry. Array reference (not slice) so release codegen has no bounds checks and no branches (verified in asm by the realtime safety audit).
  • SineTable<const LENGTH>: const fn new() via a quarter-cycle Taylor series in f64, read, read_cosine (same table, +0.25), entries. Doc comment states the (2π/N)²/8 bound.
  • pub static SINE_2048: SineTable<2049> as the shared 8 KB instance.
  • Storage length is the const parameter because [f32; N + 1] needs generic_const_exprs; the guide and eval spec are updated to match.
  • README, mdBook page (crates/core/sine-table.md), no_std compatible.

Test plan

  • cargo test --workspace --release (13 new tests + 3 doctests)
  • cargo build -p bbx_core --no-default-features
  • cargo clippy -p bbx_core --all-targets, cargo fmt --check
  • mdbook build docs
  • Realtime Safety Check agent: 0 violations

🤖 Generated with Claude Code

Adds bbx_core::table with a const-evaluated SineTable<LENGTH> (LENGTH - 1
power-of-two cells plus a guard entry, Taylor series on a quarter cycle in
f64) and read_interpolated, the guard-based linear reader that later
phase-indexed tables reuse. The storage length is the const parameter
because [f32; N + 1] needs the unstable generic_const_exprs feature.

Includes a shared SINE_2048 static, no_std support, docs page, and tests
for entry accuracy (1e-6), random reads (2e-6), exact periodicity on
dyadic phases, and compile-time construction.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@maxwellmattryan
maxwellmattryan merged commit b216052 into develop Sep 11, 2026
10 checks passed
@maxwellmattryan
maxwellmattryan deleted the feat/sine-table branch September 11, 2026 02:27
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