Repository navigation
feat(core): add SineTable and shared interpolating table read - #125
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phantom build guide step 03.
bbx_core::table::read_interpolated<const LENGTH>(&[f32; LENGTH], phase): floor-wrapped, index-clamped linear interpolation overLENGTH - 1cells 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)²/8bound.pub static SINE_2048: SineTable<2049>as the shared 8 KB instance.[f32; N + 1]needsgeneric_const_exprs; the guide and eval spec are updated to match.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-featurescargo clippy -p bbx_core --all-targets,cargo fmt --checkmdbook build docs🤖 Generated with Claude Code