PDA

View Full Version : GLSL floating point precision requirements



PkK
06-17-2007, 01:12 AM
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.

Philipp

oc2k1
06-17-2007, 06:04 AM
The most implementations are better, for example a 32bit float (but without denorm)

V-man
06-17-2007, 11:00 PM
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.