Average Error: 0 → 0
Time: 552.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 r121594 = x;
        double r121595 = r121594 + r121594;
        double r121596 = r121595 + r121594;
        double r121597 = r121596 + r121594;
        double r121598 = r121597 + r121594;
        return r121598;
}

double f(double x) {
        double r121599 = x;
        double r121600 = 4.0;
        double r121601 = fma(r121599, r121600, r121599);
        return r121601;
}

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