You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Eberly approximations from https://seblagarde.wordpress.com/2014/12/01/inverse-trigonometric-functions-gpu-optimization-for-amd-gcn-architecture/.
155
+
// input [-1, 1] and output [0, PI]
156
+
float acos_approx(float p_x) {
157
+
float x =abs(p_x);
158
+
float res =-0.156583f * x + (M_PI /2.0);
159
+
res *=sqrt(1.0f - x);
160
+
return (p_x >=0) ? res : M_PI - res;
161
+
}
162
+
163
+
// Based on https://math.stackexchange.com/questions/1098487/atan2-faster-approximation
164
+
// but using the Eberly coefficients from https://seblagarde.wordpress.com/2014/12/01/inverse-trigonometric-functions-gpu-optimization-for-amd-gcn-architecture/.
165
+
float atan2_approx(float y, float x) {
166
+
float a =min(abs(x), abs(y)) /max(abs(x), abs(y));
0 commit comments