[915] Fix fp SIN function, and use a quadratic approximation instead of Taylor.
authorEric Anholt <eric@anholt.net>
Wed, 6 Feb 2008 19:34:14 +0000 (11:34 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 6 Feb 2008 23:26:00 +0000 (15:26 -0800)
commitd98abcbef0bd4200fc0fd30fc0524bf452df3572
treef053f350ece4c97bf6b4718d22edb3cfa65ea946
parentc0e026c8090954ddb629a01cc1a93c61b2fc8298
[915] Fix fp SIN function, and use a quadratic approximation instead of Taylor.

The Taylor series notably fails at producing sin(pi) == 0, which leads to
discontinuity every 2*pi.  The quadratic gets us sin(pi) == 0 behavior, at the
expense of going from 2.4% THD with working Taylor series to 3.8% THD (easily
seen on comparative graphs of the two).  However, our previous implementation
was producing sin(pi) < -1 and worse, so any reasonable approximation is an
improvement.  This also fixes the repeating behavior, where the previous
implementation would repeat sin(x) for x>pi as sin(x % pi) and the opposite
for x < -pi.
src/mesa/drivers/dri/i915/i915_fragprog.c