glsl: Rewrite atan2 implementation to fix accuracy and handling of zero/infinity.