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 r112112 = x;
        double r112113 = r112112 + r112112;
        double r112114 = r112113 + r112112;
        double r112115 = r112114 + r112112;
        double r112116 = r112115 + r112112;
        return r112116;
}

double f(double x) {
        double r112117 = x;
        double r112118 = 4.0;
        double r112119 = fma(r112117, r112118, r112117);
        return r112119;
}

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