Florian Kl?mpfl wrote 6 lines
I believe this question is a red herring. In case "constant propagation" is an optimization aimed primarily at run-time program code (this is mainly why compilers exist) then it doesn't exactly apply to compile-time math, aka compile-time execution of non-program code. In other words, compile-time execution for the purpose of solving compiler math (not program math) could be done entirely without any this would preserve
compiler-math correctness and/or make it match run-time program-math correctness then it would yes be worth doing.
James Richters: The result of math when using constants MUST be the same as the result of identical math using variables.
Agree.
if the developer explicitly wants reduced precision, then [that's fine].
Agree.
But reduced precision should not come unexpectedly
Agree.
It is possible math is being done differently by the compiler than by programs? For math-related source code, the compiler compiles the instructions and writes them to the program file for compile-time constant calculations that produce run-time constant values, one would expect the compiler to compile the instructions, execute them during compilation, and write the resulting value to the program file for
instructions are discarded, because the program does not need them. If math is being compiled differently for program-executed calculations versus compiler-executed calculations, then that would be a problem.
