Use templated pow, sin, cos for precision