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.
Hi,
while using double variables I encountered an unexpected behaviour. But first some words what I'm doing:
I'm sampling data with an ADC and to reduce the sampling noise, I am implementing a low pass filter in code. So far no problem. The problem is, that I never reach the final value due to numeric problems.
float LowPassResult=0; LowPassResult = (*LowPass) + (ADC - (*LowPass))/K_LP; *LowPass = LowPassResult;
Debugging this code, I can observe the following:
LowPassResult has a value of 1.481625E+3, but in *LowPass it is saved as 1.481E+3.
I don't understand that, cause LowPassResult and *LowPass have the same data type... Can someone explain that behaviour and/or know how I get the desired behaviour??
Thanks in advance!
IAR, OK.
The datatype double should have 64bits. 32 is single float precision. You can change this in the project settings.
**Attention** This is a public forum