3 Replies Latest reply on Nov 17, 2014 12:16 PM by Robert_U

# OpenGL GLSL sin, cos, and sqrt precision on Intel HD 5000

What is the maximum, actual precision of the sin, cos, and sqrt functions on an Intel HD 5000? I am working with a Surface Pro 3.

I have a calculation in a shader which generates a cartesian position from a WGS84 location.

The result is off by about 0.00001 radians. This would seem to suggest that Intel's trig precision is the bottom of the barrel for GLSL support -- 1/100000.

This function works perfectly on an ancient NVidia Geforce 8400 GS. The exact same shader, with the same inputs, produces an output with an undesirable offset.

I need to know the precision to know whether I just have to avoid Intel cards entirely.

I may be able to provide more info as needed, but I need to use this as a starting point.

Alternatively, are there any caveats or gotchyas with Intel GLSL math, as opposed to NVidias, that someone might know of?

• ###### 1. Re: OpenGL GLSL sin, cos, and sqrt precision on Intel HD 5000

Hi Michael

I am looking into your questions and will report back on this thread soon.

Thanks

Robert

• ###### 2. Re: OpenGL GLSL sin, cos, and sqrt precision on Intel HD 5000

Thanks.

I tried double precision in the shader, which only works for sqrt, and it had no effect. So that might zero it in on the cos/sin.

I actually think the float type has higher precision than the NVidia card, but I can't easily confirm that. But the ellipsoid math is producing an incorrect result.

Note that the angles are all between -PI and PI. Most experiments are between 0 and PI or 0 and PI/2.

• ###### 3. Re: OpenGL GLSL sin, cos, and sqrt precision on Intel HD 5000

Hi Michael

Yes, you are correct – double precision sin/cos functions are not present in GLSL.

Maybe ‘precise’ qualifier will help. It tells compiler not to optimize math expressions (for example, do not replace ‘x /y’ with ‘x * rcp(y)’).

Thanks

Robert