This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

atan2sp(y,x) differs from atansp(y/x)

Other Parts Discussed in Thread: MATHLIB

Hi all,

I recently had a problem with the function atan2sp which wasn't giving me the expected result. It was a kind of multiplied by two. I then replaced it with the atansp, passing it the quotient of the input values. The result was right.

Did anyone had similar problems with the atan2sp or atan2dp ? Is this the right behaviour ?

I run it on a C6657, using CCSv6 and the compiler c6000_7.4.15, set in floating point strict mode.

Thanks,

Luca

  • It is correct that atan and atan2 produce different results for certain (x,y).  atan has a range (-pi/2, pi/2), atan2 has a range (-pi, pi], etc.  I am guessing that is not what you mean.

    One suggestion is to try and compare a large sampling of the domain of atan2sp against a benchmark.  For the benchmark an easy choice is <math.h>'s double atan2(double, double).  Each atan2sp result should be within a small tolerance of atan2.  Alternatively it might be better dumping the output from atan2sp and comparing it to an independent source, like results from a spreadsheet application.

    While I don't know of any current bug with MATHLIB's atan2sp, I wouldn't rule it out.  There is currently a bug with arguably one of the library's most basic functions (divsp).

  • User347219,

    Thank you for the support and contribution to e2e.

  • I did a quick test with a small set of inputs of comparing TI MATHLIB C66x 3.1.1.0 atan2sp with a cygwin gcc <math.h>'s atan2f.  The results were similar.

  • To make it easier for me, can you send me the "a" and :b: values for atan2sp and the "a" value of atansp with the results that you get?

    I will try it here

    Thanks

    Ran