Hello,
I am using F28377D, and have some question on its floating point calculation.
I am basically reading ADC values, scale it and output to DAC. For example, I can have
int16 a, b; // a, b are 12-bit ADC readings
int32 c; // c is an intermediate variable in the calculation
int16 d; // d is output to DAC
I have some calculation like:
c = (a-10)*50/47;
d = c+b/7;
My question is basically what is the best practice for calculation like this? (In my case I care more about speed, it is not a problem if the integer number is off by 1, etc. )
My understanding is that is would be actually better to write
c = (a-10)*1.06382978
instead of *50/47, for both accuracy and time?
Also the intermediate variable c, does it make a speed difference if I declare it as float instead of int32?
Lastly, is there library that I need to include to use fpu and Trigonometric Math Unit?
Thank you for clarifying these questions for me.