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.

Compiler/TMS320F28069: sqrt() function not working

Part Number: TMS320F28069
Other Parts Discussed in Thread: C2000WARE

Tool/software: TI C/C++ Compiler

Hello All,

I'm trying to use the sqrt() function, but it's not working and I don't know what I'm doing wrong.

I've included math header files like this:  (yes, I'm using IQ math and CLA math too)
#include "math.h"
#include "IQmath/IQmathLib.h"
#include "CLAmath/Cla_typedefs.h"

Here are a couple def's:
#define MATH_TYPE    FLOAT_MATH
#define GLOBAL_Q    30

I'm successfully using sin() and cos() from that same library.  I put the sqrt() and sin() functions one after the other for demo.

Here's some code:

The function "sqrt(36.0);" returns the value "36.0", when it should return "6.0".  Any value I place there is simply passed through.

However, the function sin((w0) / (2*q);" returns the correct value.

I don't get any errors or warnings.

Do I have to manually load some tables?

I'm running:

  1. CCS v7.3.0.00019
  2. Eclipse C/C++ dev tools 9.0.0.201606062011
  3. C2000 sevice support 4.2.1.0

Thanks,
robin

  • Hi Robin,

    Do the other square root functions within math.h work, such as sqrtf(float x) or sqrtl(long double x)? I tried replicating your issue in a C2000ware example, but the function worked OK. Including math.h as you did should be sufficient.

    Maybe try this without including IQMath and CLAMath and see if those are interfering in some way. Also, check your "Processor Options" and "Optimization" options in your project properties. My working project has the following:

    Best,

    Kevin

  • Hi Robin,

    I haven't heard a response in a few weeks and am assuming you were able to resolve your issue. If this isn’t the case, please reject this resolution or reply to this thread. If this thread locks, please make a new thread describing the current status of your issue.

    Best,
    Kevin
  • Hi Kevin,

    Sorry for the long delay.

    The project has been shelved, so I didn't take it any further.  It will be some time before it sees the light of day again, so I'm dropping the issue for now.

    Thanks for your help.