2010-07-29 04:14 PM
Cosmic Compiler Float Calculation Errors
2011-05-17 06:09 AM
Greetings:
I found a work-around. I moved the float calculation function to the main.c file and then declared it as an ''extern'' function within the original file. This solved the problem with the erroneous calculation. Does anyone have any idea why this code would be file location sensitive? There are not any errors or warnings. Best Regards, Tom Alldread2011-05-17 06:09 AM
Hi Luca,
Thanks for your interest! Both variables are declared as floats in the main.c file and declared as externs in the local file. Everything is the same for both. I am left with the impression there is a bug in the compiler as the variables are declared as floats in the same location and the calculations are within the same function. The order doesn't matter. Cz always works and Cs always fails. With the calculations moved to main.c into a stand alone function and then declared/called as extern function they both work. I reported the issue to Cosmic as an unsolved mystery. I can live with the work-around now that I know how to implement it. Best Regards, Tom Alldread2011-05-17 06:09 AM
2011-05-17 06:09 AM
2011-05-17 06:09 AM
Greetings Luca:
Many thanks for your follow up, your analysis is correct! Although I had declared the problematic variables as floats I erred when I declared them as externs. I usually use copy and paste for re-declaring variables but I guess in this case I did not and ended up with the extern variables declared as u32. Changing the externs to float resolved the issue. I apologize for my error! Changing topics can you point me to some EEPROM variable examples? Thank you for your assistance! Best Regards, Tom Alldread2011-05-17 06:09 AM