Average Error: 0 → 0
Time: 962.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 r595 = x;
        double r596 = r595 + r595;
        double r597 = r596 + r595;
        double r598 = r597 + r595;
        double r599 = r598 + r595;
        return r599;
}

double f(double x) {
        double r600 = x;
        double r601 = 4.0;
        double r602 = fma(r600, r601, r600);
        return r602;
}

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