Average Error: 0 → 0
Time: 570.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 r105357 = x;
        double r105358 = r105357 + r105357;
        double r105359 = r105358 + r105357;
        double r105360 = r105359 + r105357;
        double r105361 = r105360 + r105357;
        return r105361;
}

double f(double x) {
        double r105362 = x;
        double r105363 = 4.0;
        double r105364 = fma(r105362, r105363, r105362);
        return r105364;
}

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