Constexpr Sine Lookup Table
Generate a quarter-wave sine table at compile time for a DDS waveform generator, so no runtime trig and no float math is needed on the target.
Constraints
- 256 entries covering 0 to pi/2, stored as int16_t Q15.
- Table must be constexpr - computed by the compiler.
- Use a Taylor series; std::sin is not constexpr.
- Accuracy within 32 LSB of the true value.
- static_assert the endpoints.
1#include <cstdint>2#include <array>3 4// TODO: constexpr quarter-wave sine table