Average Error: 0 → 0
Time: 597.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 r138571 = x;
        double r138572 = r138571 + r138571;
        double r138573 = r138572 + r138571;
        double r138574 = r138573 + r138571;
        double r138575 = r138574 + r138571;
        return r138575;
}

double f(double x) {
        double r138576 = x;
        double r138577 = 4.0;
        double r138578 = fma(r138576, r138577, r138576);
        return r138578;
}

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