Average Error: 0 → 0
Time: 612.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 r88110 = x;
        double r88111 = r88110 + r88110;
        double r88112 = r88111 + r88110;
        double r88113 = r88112 + r88110;
        double r88114 = r88113 + r88110;
        return r88114;
}

double f(double x) {
        double r88115 = x;
        double r88116 = 4.0;
        double r88117 = fma(r88115, r88116, r88115);
        return r88117;
}

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