Average Error: 0 → 0
Time: 565.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 r118777 = x;
        double r118778 = r118777 + r118777;
        double r118779 = r118778 + r118777;
        double r118780 = r118779 + r118777;
        double r118781 = r118780 + r118777;
        return r118781;
}

double f(double x) {
        double r118782 = x;
        double r118783 = 4.0;
        double r118784 = fma(r118782, r118783, r118782);
        return r118784;
}

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