Saturday, August 8, 2009

That new code smell - With C# example

The High Performance Game Development article is coming along fine. I wrote up some C# code that follows with the article, most of the code is examples on transcendental function approximations.

Here is a pretty example on a sine function using Taylor Series:

public static float FastSin(float x)
{
    return x - ((x * x * x) / 6) + ((x * x * x * x * x) / 120)
        - ((x * x * x * x * x * x * x) / 5040);
}

Much more to come!

No comments:

Post a Comment