-
-
Notifications
You must be signed in to change notification settings - Fork 19
Replace a few occurrences of atan(Y/X) with atan2(Y, X) #59
Copy link
Copy link
Closed
Description
A potential bit of code maintenance:
I noticed a few occurrences of atan(Y/X) in the xsf code. Generally these can be written atan2(Y, X), which avoid a potential division by 0 and gives results from (-pi, pi) instead of (-pi/2, pi/2). Here's what a search with a regex finds:
$ rg "atan\([^)]*/.*\)"
specfun/specfun.h
706: phi = atan(y / x);
785: th = atan(yy / x0);
798: gi1 += atan(yy / (xx + j));
805: th1 = atan(yy / xx);
809: th2 = atan(si / sr);
amos/amos.h
3363: t1 = fabs(atan(yy / xx));
4821: ang = atan(zthi / zthr);
It might be worthwhile checking if any of those can be replaced by atan2.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels