<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Am 16.02.2024 um 08:32 schrieb Florian Kl?mpfl via fpc-pascal:
    <blockquote type="cite"
      cite="mid:mailman.157.1708127408.1196.fpc-pascal@lists.freepascal.org">
      <blockquote type="cite">Am 16.02.2024 um 08:23 schrieb Ern Aldo
        via fpc-pascal:
        <blockquote type="cite">Compile-time math needs to be as correct
          as possible. RUN-time math can worry about performance.
        </blockquote>
        So you are saying when constant propagation is on, an expression
        should have a different result than with constant propagation
        off?
      </blockquote>
      Bernd: I don't know exactly, what you mean by constant
      propagation.</blockquote>
    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 optimizations at all. If this would preserve
    compiler-math correctness and/or make it match run-time program-math
    correctness then it would yes be worth doing.<br>
    <br>
    <blockquote type="cite"
      cite="mid:mailman.157.1708127408.1196.fpc-pascal@lists.freepascal.org">James
      Richters: The result of math when using constants MUST be the same
      as the result of identical math using variables.</blockquote>
    Agree.<br>
    <br>
    <blockquote type="cite"
      cite="mid:mailman.157.1708127408.1196.fpc-pascal@lists.freepascal.org">if
      the developer explicitly wants reduced precision, then [that's
      fine].<br>
    </blockquote>
    Agree.<br>
    <br>
    <blockquote type="cite"
      cite="mid:mailman.157.1708127408.1196.fpc-pascal@lists.freepascal.org">But
      reduced precision should not come unexpectedly</blockquote>
    Agree.<br>
    <br>
    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 execution at
    runtime. 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 use at runtime. Such
    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.<br>
  </body>
</html>