Skip to content

Instantly share code, notes, and snippets.

@rygorous
Created December 1, 2010 07:48
Show Gist options
  • Save rygorous/723131 to your computer and use it in GitHub Desktop.
Save rygorous/723131 to your computer and use it in GitHub Desktop.
Chebyshev v2
__forceinline double chebyshev_ryg(int n, double x)
{
if (n == 0) return 1.0;
if (n == 1) return x;
double t = x, t1 = 1, t2;
x += x;
for (int i=1; i<n; i++) {
t2 = t1;
t1 = t;
t = x * t1 - t2;
}
return t;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment