Klang C++ 0.7.15
Language Reference (draft)
Loading...
Searching...
No Matches
sin

Language Guide / Functions · Generated API signature

sin

klang::fast::sin

Approximate sine from an angle in radians.

Use fast::sin with a float angle in radians in the range [0, 2π). Wrap other angles to one turn before calling. The phase reduction uses a fixed-point conversion. The implementation folds the phase into a smaller angle range and evaluates a seventh-degree polynomial. In a native test across 65,536 phases over one turn, the largest absolute error was about 0.0000066. For ordinary trigonometry over a wider input range, see sin.

Direct call

const signal wave = fast::sin(phase);

Signal flow

const signal wave = signal(phase) >> fast::sin;