Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p_atan2.c is b/a or a/b? #223

Open
twocs opened this issue Oct 10, 2015 · 1 comment
Open

p_atan2.c is b/a or a/b? #223

twocs opened this issue Oct 10, 2015 · 1 comment

Comments

@twocs
Copy link
Contributor

twocs commented Oct 10, 2015

Looking at the relevant lines of p_atan2.c at https://github.com/parallella/pal/edit/master/src/math/p_atan2.c

  • Calculates the inverse tangent (arc tangent) of b/a. Stability not guaranteed
  • for 'a' values near 0. Results are in the range of -pi to pi.
  • @param a Pointer to denominator input vector
  • @param b Pointer to numerator input vector
    void p_atan2_f32(const float *a, const float *b, float *c, int n)

Contrast this with atan2 ISO/IEC 9899:1999 (E)
The atan2 functions compute the value of the arc tangent of y/x, using the signs of both
arguments to determine the quadrant of the return value. A domain error may occur if
both arguments are zero.
double atan2(double y, double x);

In my impression, the signature of atan2(y, x) becomes atan(y/x) with some edge conditions.
However, the signature of p_atan2(a, b, ...) becomes atan(b/a) [or equivalently p_atan2(y, x, ...) becomes atan(x/y)].

Isn't this inverted? Is it intentional?

@jar
Copy link
Contributor

jar commented Oct 20, 2015

@twocs
It's obviously inverted and it probably wasn't intentional. Breaking an API should generally be avoided, but this software is still under development, so you should put in a pull request to patch it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants