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.
Hello
I'm periodically seeing some erroneous floating point arithmetic results when having interrupts enabled.
To be clear, these calculations are being done in a function periodically called from the main loop. Most of the time the results are correct, but periodically I'm seeing the result going to zero when using the same multiplicand/multiplier/etc.
My routine does several floating point multiplications, divisions, etc.
I noticed that when I disable interrupts, the results are correct and consistent.
An example of code snippet is as follows:
static real32 A;
static real32 B;
A = 100.0 * 1500.0;
B = ((A / 20000.0F) * 100);
The value of B goes to 0.0 randomly sometimes.
Could you please provide some insight on this?
Hello QJ Wang
Sorry for my delayed response.
In our codebase, UsingFPU was not enabled for the particular task responsible for the floating point arithmetic. When it was enabled, then we no longer see the issue of Erroneous floating point arithmetic results anymore.
Thanks a lot.