My first comment is that based on the code, you DON’T know that x is close to 25, it all depends on the value it had before executing those statements. If x is an auto variable, and hasn’t had a value previously assigned to it, it could have ANY value (or even no value) and the code has invoked undefined behavior, and can do anything. Given your answer, x probably starts with a value of about -28420.
@richard_damon: I didn’t mention that the variables x and y are declared like
double x = 0.0;
double y = 0.0;
I use the gdb debugger in order to watch this expression, so I can see that x is about 25.0 and I can also see the result of y. I am sure that the debugger displays the correct values.
I presume, you are expecting y to be somewhere near 5. Does the code work if you put it in main()? If not then its not a FreeRTOS issue, but more likely a configuration issue.
The only problems with floating point in the past have been related to stack alignment, which was historically set to 4, but if you are using V6.0.4 then I think you should have 8 byte alignment as standard. You might want to check though.