Sine Lookup Table Generator

Generate accurate sine tables for any angular range, step size, and precision. Visualize the sine waveform with sampled points.

Quick presets:
Full cycle 0°→360°, step 30°
0°→90°, step 15°
0 → 2π, step π/12 (rad)
0°→359°, step 1° (1‑degree LUT)
0→π rad, step 0.1 rad
Client-side only: All calculations run locally in your browser. No data is uploaded or stored. Full precision using JavaScript double-precision floats.

Sine Lookup Tables: Theory & Practical Applications

A sine lookup table (LUT) precomputes values of the sine function over a discrete set of angles. This technique is fundamental in real-time embedded systems, digital oscillators, motor control, and graphics where computational cost of trigonometric functions must be minimized. The table trades a small amount of memory for deterministic, high-speed execution — often 10–100x faster than calling sin() on low-end microcontrollers.

Mathematical foundation: For each angle θᵢ = start + i·step, we store S[i] = sin(θᵢ). Linear interpolation between entries yields acceptable accuracy for most applications. The error depends on step size and interpolation method.

Accuracy & Precision Considerations

Double-precision floating point provides ~15 decimal digits of accuracy. When generating fixed-point LUTs (e.g., Q15 format for DSP), you can scale the output. This generator allows up to 8 decimal places, sufficient for high-fidelity audio synthesis or control loops. For embedded usage, truncation to 16-bit integers is common: int16_t sin_value = round(sin(angle) * 32767).

Verification against known values: This tool uses the standard JavaScript Math.sin function (IEEE 754 double precision). Known test points: sin(30°)=0.5, sin(90°)=1, sin(0°)=0. Any discrepancy < 1e-15 is due to floating-point rounding. Cross‑check any row with a trusted reference (Wolfram Alpha, GNU Octave, or a certified math library).
Typical Use Cases
  • Direct Digital Synthesis (DDS) waveform generators
  • 3D rotation matrices & quaternion interpolation
  • PWM signal generation for AC motor control
  • Fast Fourier Transform (FFT) twiddle factors
  • Procedural texture & procedural animation
Step size vs. Error

The maximum interpolation error for a sine table is approximately (Δθ)² / 8 for the second-order Taylor bound. For Δθ = 1° (π/180 rad), worst-case error ~0.00015; for Δθ = 5°, error ~0.0038. Trade memory footprint for precision — this tool helps you design optimal tables.

Case study: Digital Synthesizer

A polyphonic synthesizer engine requires 48 kHz sample rate and 16 voices. Computing sin() on an ARM Cortex-M4 in real time is possible but costly. Using a 256-entry sine LUT (0°–360°, step 1.406°) with linear interpolation reduces CPU load by ~85% while maintaining THD below -80dB. This generator can produce that exact table for direct integration into C/C++ header files.

Performance benchmark (Cortex-M4, 168 MHz): sin() call ~520 cycles, LUT with linear interpolation ~80 cycles. 85% reduction, enabling 16‑voice polyphony at 48 kHz.

Generating Sine Tables via CORDIC vs Polynomial Approx

Modern lookup tables often combined with small interpolation or Taylor expansion. The method used here is direct evaluation of the standard math library sin() using the system's floating-point unit – ideal for prototyping. For resource-constrained MCUs, precomputed tables are then transferred into ROM. Our CSV export can be directly imported into Python, MATLAB, or embedded build systems.

Implementation note: All calculations are performed in your browser using the IEEE 754 compliant Math.sin as defined by ECMAScript. The tool does not rely on any external API or server-side processing. For verification, you may compare the output against any standard mathematical software.

References: Abramowitz & Stegun, "Handbook of Mathematical Functions"; Knuth, "The Art of Computer Programming". The interactive graph uses standard Canvas rendering. Last updated May 2026.

Frequently Asked Questions

To maintain performance, the generator limits rows to 2500. If your range/step produces more entries, you'll see a warning. For practical embedded LUTs, 256–1024 entries are typical.

Copy the CSV, paste into a text editor, format as const float sin_table[] = { ... };. Most code editors support column editing. You can also post-process the CSV with a script.

The JavaScript Math.sin() function expects radians. The tool automatically converts degree inputs to radians before computing sine. The displayed angle column shows the selected unit for clarity.

Yes! Enable "Include Cosine" in the control panel. The table and graph will show both sine (blue) and cosine (gray) values. Cosine values are derived from sin(θ + π/2).

For 16-bit audio quality with linear interpolation, a step of 1° (360 entries) or 2° (180 entries) is common. For high fidelity (24-bit), a step of 0.5° works well.

All computations use your browser’s Math.sin, which conforms to the IEEE 754 standard (ECMAScript specification). You can cross‑check any row against known values (e.g., sin(30°)=0.5, sin(π/2)=1). The tool also displays min/max statistics to detect anomalies. For critical systems, we recommend verifying with a secondary source such as Wolfram Alpha or a certified math library.
Recommended references: Wolfram MathWorld – Sine, “Digital Signal Processing” by Proakis & Manolakis, ARM application note AN298.