glsl: improve the accuracy of the atan(x,y) builtin function.
authorPaul Berry <stereotype441@gmail.com>
Wed, 27 Jul 2011 22:53:31 +0000 (15:53 -0700)
committerPaul Berry <stereotype441@gmail.com>
Mon, 1 Aug 2011 21:37:38 +0000 (14:37 -0700)
commitb1b4ea0b3679db0b8fddaa9663a10d4712bba3b7
tree37b2c030f632c42ec7e6d2dfdd00ba19122bf99a
parentd4c80f5f85c749df3fc091ff07b60ef4989fa6d9
glsl: improve the accuracy of the atan(x,y) builtin function.

The previous formula for atan(x,y) returned a value of +/- pi whenever
|x|<0.0001, and used a formula based on atan(y/x) otherwise.  This
broke in cases where both x and y were small (e.g. atan(1e-5, 1e-5)).

This patch modifies the formula so that it returns a value of +/- pi
whenever |x|<1e-8*|y|, and uses the formula based on atan(y/x)
otherwise.
src/glsl/builtins/ir/atan