I'm using F28069 and have been using the CLA and CLA math library to compute RMS in the following way:
VinRMS = CLAsqrt(VinSqSum / BUF_LEN);
where VinSqSum is a running sum of squares, and BUF_LEN is the number of samples ... this has been working fine and I get normal RMS calculations.
I read about CLAdiv in the CLA documentation and I wanted to try it because I thought it might be faster. To avoid nested function calls (as advised to in the CLA documentation), I do the following:
float32 temp1; temp1 = CLAdiv(VinSqSum, BUF_LEN); VinRMS = CLAsqrt(temp1);
Now, VinRMS is coming out with unreasonable calculations. Instead of the ~120Vrms, now it is calculating some huge number like 3.402823e+38 which seems like an overflow.
I checked the values being computed by CLAdiv, and they seem ok .. it seems the CLAsqrt() is causing things to blow up?
I double-checked and VinSqSum is always positive, and BUF_LEN is #define to be a positive integer, so the argument to CLAsqrt is never negative.