cancel
Showing results for 
Search instead for 
Did you mean: 

Standarddeviation using DSPLib returns 0

Posted on August 19, 2015 at 15:02

Hi,

I have encountered the following problem on the STM32F4 using the CMSIS DSP Library V1.4.2:

When calculating the standard deviation using arm_std_f32() of the following values

</colgroup>

7111.15283

7111.38672

7111.40527

7111.50684

7111.59375

7112.03369

7112.12793

7112.1416

7112.68164

7113.02783

the result is 0. This has been verified using the CM4 implementation with FPU. Also, quite often I get results of exactly 2.0 or 4.0 which is very unlikely as my input values are noisy.Can someone reproduce this behavior? Am I running into the limits of single precision floats?thanks, Martin
3 REPLIES 3
Posted on August 19, 2015 at 16:55

There are significantly more recent versions of the DSP Library, V1.4.4 is included in the most recent F4 DSP Library release. ARM has V1.4.5 for download.

May be you could post a more complete example?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 19, 2015 at 18:04

Nevermind

DSP arm_std_f32 test CMSIS DSP V1.4.4

mean = 7111.906250

std = 0.000000 (M4F)

std = 0.000000 (M0)

std = 0.607880 (double)

Loss of precision causes var to go negative, can't square root that.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 20, 2015 at 12:54

So it is indeed a floating point limitation. Thanks for verifying!