Tool/software: TI C/C++ Compiler
I'm working on an F28379D with Compiler v20.2.2.LTS. Let's say I have the following code:
outputA = (float)2/3*inputA;
The compiler reference manual states that:
"For optimal evaluation, the compiler simplifies expressions into equivalent forms, requiring fewer instructions or registers. Operations between constants are folded into single constants. For example, a = (b + 4) - (c + 1) becomes a = b - c + 3."
My question is this, does the compiler recognise that (float)2/3 is always 0.66666666667 and make a subsitution at compile time, or does it instead ask the microprocessor to actually compute 2/3 using its FPU every time? I am considering making this substitution myself with #define preprocessor statements but I am curious if the compiler is actually doing it for me.