Hi everybody, i'm quite new with freescale/nxp mcu's and i'm having a problem using flaoting point arithmetic. The problem is that some float operations are writing trash over some other variables that i don't want to modify. The operations are done well and fast with good results but they write trash in some memory adresses that are occuped by other variables. This happens, for example with theese operations:
f1=floor(bufferTX); f2=fabs(bufferTX - f1); i1=(int)f1; i2=(int)10*f2;
or with:
t/=10; t=0.000006*pow(t,3)-0.00081*pow(t,2)+0.3*t-20;
f1,f2, bufferTX and t are floats, i1 and i2 ints.
What could be happening? I've added ansis.lib to the project and i'm using CodeWarrior 6.1with DEMO9S08LC60 kit.
Any suggestion will be very helpful.
Thanks!
Solved! Go to Solution.
Normally this issue may because of the stack overflow. please increase the stack size in prm file then test it again.
If the problem persists, please upload your demo project here, I can check it directly from my side. thanks!
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Normally this issue may because of the stack overflow. please increase the stack size in prm file then test it again.
If the problem persists, please upload your demo project here, I can check it directly from my side. thanks!
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jennie Zhang, thank you very much for the answer!
I've duplicated the Stack size and now everything works fine!
Regards
You are welcome!
Have a great day,
Jennie Zhang