Average Error: 0 → 0
Time: 578.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 r139465 = x;
        double r139466 = r139465 + r139465;
        double r139467 = r139466 + r139465;
        double r139468 = r139467 + r139465;
        double r139469 = r139468 + r139465;
        return r139469;
}

double f(double x) {
        double r139470 = x;
        double r139471 = 4.0;
        double r139472 = fma(r139470, r139471, r139470);
        return r139472;
}

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