Average Error: 0 → 0
Time: 572.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 r137122 = x;
        double r137123 = r137122 + r137122;
        double r137124 = r137123 + r137122;
        double r137125 = r137124 + r137122;
        double r137126 = r137125 + r137122;
        return r137126;
}

double f(double x) {
        double r137127 = x;
        double r137128 = 4.0;
        double r137129 = fma(r137127, r137128, r137127);
        return r137129;
}

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