There are ways to build tables of values at compile time using templates. In C++14 there will be a way to do it using constexpr. Or you could write a quick python program to precacluate the values and create a C++ array with the values.