The following rules apply to both single and double-precision floating point instructions:
The precision of double-precision instructions is at least that of single precision. For single precision (32 bit) instructions, precisions are required to be at least as follows, unless decorated with RelaxedPrecision:
Table A.2. Precision of core SPIR-V Instructions
Instruction | Precision |
---|---|
| Correctly rounded. |
| Correctly rounded. |
| Correctly rounded. |
| Correct result. |
| Correct result. |
| Correct result. |
| Correct result. |
| Correct result. |
| 2.5 ULP for b in the range [2-126, 2126]. |
conversions between types | Correctly rounded. |
Table A.3. Precision of GLSL.std.450 Instructions
Instruction | Precision |
---|---|
| Inherited from |
| $(3 + 2 \times |x|)$ ULP. |
| 3 ULP outside the range [0.5, 2.0]. Absolute error < 2-21 inside the range [0.5, 2.0]. |
| Inherited from |
| Inherited from 1.0 / |
| 2 ULP. |
GLSL.std.450 extended instructions specifically defined in terms of the above instructions inherit the above errors. GLSL.std.450 extended instructions not listed above and not defined in terms of the above have undefined precision. These include, for example, the trigonometric functions and determinant.
For the OpSRem
and OpSMod
instructions, if either operand is
negative the result is undefined.
![]() | Note |
---|---|
While the |