Giovanni Mascellani (@giomasce) commented about tests/hlsl/inverse-trig.shader_test:
+[pixel shader] +uniform float4 a;
+float4 main() : sv_target +{
- // Return things in terms of pi to make the numbers in the
- // test cases more understandable.
- // Also, because the argument order is (y,x) the numbers are
- // passed in "backwards" here, so they're the right way in the
- // test cases.
- return float4(atan2(a.x, a.y), 0.0, 0.0, 0.0) / 3.14159265;
+}
+[test]
Please, also test more "random" values of `x` and `y`, including cases in which `x` and `y` are different in absolute value, cases in which either `x` or `y` is very small but not zero, or infinite, or very large but not infinite, or a negative zero. The point of using `atan2(y, x)` rather than `atan(y / x)` is to have a lot of corner cases dealt with automatically (see for example the `atan2` Linux man page), so I think we should test for that.