I see people over use (imo) atan2 a lot. Granted it's mostly in gameplay code, not shader code, but a common pattern is to use atan2 to find the angle between two points and use that angle to rotate a vector to get facing direction, when a simpler normalize would work.
#pico-8 has weird behavior where this is faster, because sqrt's artificial cost is higher than atan2's artificial cost in the VM. sqrt is 48 "cycles" and atan2 is 4.
And GPU apis allow the implementation to take a lot of shortcuts, so you almost certainly won't get IEEE behaviour. And there are a lot of rough corners on this one.
We had to dumb down WGSL's definition after testing various back ends in our CTS.
Comments
https://inria.hal.science/hal-01091138/document
We had to dumb down WGSL's definition after testing various back ends in our CTS.
https://www.w3.org/TR/WGSL/#atan2-builtin