Hi all,

I use matlab to generate c code and have this code compile in IAR for STM32F4 as a library. So I have no ST libraries added just the c code and h files from matlab.

Matlab uses sqrt, sin functions etc. declared at math.h, these functions use double and I'm looking for a way to force the compiler to use float (so the FPU will be used), I can't go through the entire code and switc every function used for the float equivalent. is there a simple way to do so?

Thank you

I use matlab to generate c code and have this code compile in IAR for STM32F4 as a library. So I have no ST libraries added just the c code and h files from matlab.

Matlab uses sqrt, sin functions etc. declared at math.h, these functions use double and I'm looking for a way to force the compiler to use float (so the FPU will be used), I can't go through the entire code and switc every function used for the float equivalent. is there a simple way to do so?

Thank you

However, I'm convinced no one will "automatically" translate sqrt ()/sin() calls to sqrtf()/sinf() etc.

Perhaps your IDE/Editor supports refactoring.

A much better approach would be to force your matlab model to use float instead of the wasteful double. (Don't ask me, I'm not a mathlab user ...).