Average Error: 0 → 0
Time: 572.0ms
Precision: 64
\[\left(\left(\left(x + x\right) + x\right) + x\right) + x\]
\[\mathsf{fma}\left(x, 4, x\right)\]
\left(\left(\left(x + x\right) + x\right) + x\right) + x
\mathsf{fma}\left(x, 4, x\right)
double f(double x) {
        double r115896 = x;
        double r115897 = r115896 + r115896;
        double r115898 = r115897 + r115896;
        double r115899 = r115898 + r115896;
        double r115900 = r115899 + r115896;
        return r115900;
}

double f(double x) {
        double r115901 = x;
        double r115902 = 4.0;
        double r115903 = fma(r115901, r115902, r115901);
        return r115903;
}

Error

Bits error versus x

Derivation

  1. Initial program 0

    \[\left(\left(\left(x + x\right) + x\right) + x\right) + x\]
  2. Simplified0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 4, x\right)}\]
  3. Final simplification0

    \[\leadsto \mathsf{fma}\left(x, 4, x\right)\]

Reproduce

herbie shell --seed 2020057 +o rules:numerics
(FPCore (x)
  :name "Main:i from "
  :precision binary64
  (+ (+ (+ (+ x x) x) x) x))