GLSL floating point precision requirements

The GLSL specification says that the guidelines for precision
established by the OpenGL 1.4 specification must be met (page 16).
The OpenGL 1.4 specification requires that “individual results of
floating-point computations are accurate to about one part in 100000”
(page 6).
Does this apply to functions like sin(), pow(), etc?
It seems to me to 1/10000 is a maximum relative error, which means that
sin(0) has to be exactly 0, etc. I suppose this requirement would be
very difficult to meet at cos(nearest float to pi/2), since the result
would be very small.


The most implementations are better, for example a 32bit float (but without denorm)

Maybe GPUs have lookup tables for these cases (0, Pi/4, Pi/2, Pi*3/4, Pi, …)
At least that how it is for CPUs. It’s a CPU optimization so it should be in your GPU as well.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.