On Tue, Jan 19, 2010 at 2:48 PM, Wormszer <worm...@...> wrote:
For doing a gpu version of a shader this might work
A GPU only version is definitely interesting, but a very big job :)
but as a stand-in for
the C99 math i don't think it would be a good solution.
Heck no! Instead I imagine that most of the functions can be easily
implemented in terms of existing C89 functionality. For instance, AFAIK the
double version of log2 exists in C89, so
float log2f(float x) { return log2(x); }
even if I'm mistaken, natural log definitely exists, so you could use
something like
float log2f(float x)
{
// log2(x) = log(x)/log(2) ~= 1.4426950408889633 * log(x)
return 1.4426950408889633 * log(x);
}
~Chris.