Skip to content

Instantly share code, notes, and snippets.

@dernatsch
dernatsch / sintable.cpp
Created June 13, 2020 11:37
Sine lookup-table generated at compile time.
#include <iostream>
#include <cmath>
template<int size>
struct SinTable {
constexpr SinTable() : values() {
for (int i = 0; i < size; i++) {
double angle = (M_PI*2)*(((double)i)/size);
template<int f>
struct fact {
int n = f * fact<f-1>().n;
};
template<>
struct fact<0> {
int n = 1;
};