Average Error: 0 → 0
Time: 562.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 r118234 = x;
        double r118235 = r118234 + r118234;
        double r118236 = r118235 + r118234;
        double r118237 = r118236 + r118234;
        double r118238 = r118237 + r118234;
        return r118238;
}

double f(double x) {
        double r118239 = x;
        double r118240 = 4.0;
        double r118241 = fma(r118239, r118240, r118239);
        return r118241;
}

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 2020060 +o rules:numerics
(FPCore (x)
  :name "Main:i from "
  :precision binary64
  (+ (+ (+ (+ x x) x) x) x))