On Mon, 26 Aug 2024, Kai Song via Gcc-help wrote:
Since GCC can optimize algebraic expressions involving double, float, etc., I would enjoy if I could use it (somehow) to improve algebraic expressions of my initial_source.cpp before compilation.
If you are ok with proceeding in several steps (use a code generator other than the preprocessor / template meta-programming), I think there are a number of programs (other than compilers) that aim to optimize mathematical expressions, for various criteria. For instance, herbie (https://herbie.uwplse.org/ , I haven't used it myself) tries to modify the formula so its evaluation in floating point is more acurate (and/or faster).
-- Marc Glisse