Average Error: 0.1 → 0.0
Time: 12.3s
Precision: 64
\[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x\]
\[\mathsf{fma}\left(y, 2, \mathsf{fma}\left(3, x, z\right)\right)\]
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x
\mathsf{fma}\left(y, 2, \mathsf{fma}\left(3, x, z\right)\right)
double f(double x, double y, double z) {
        double r109358 = x;
        double r109359 = y;
        double r109360 = r109358 + r109359;
        double r109361 = r109360 + r109359;
        double r109362 = r109361 + r109358;
        double r109363 = z;
        double r109364 = r109362 + r109363;
        double r109365 = r109364 + r109358;
        return r109365;
}

double f(double x, double y, double z) {
        double r109366 = y;
        double r109367 = 2.0;
        double r109368 = 3.0;
        double r109369 = x;
        double r109370 = z;
        double r109371 = fma(r109368, r109369, r109370);
        double r109372 = fma(r109366, r109367, r109371);
        return r109372;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.1

    \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, 2, \mathsf{fma}\left(3, x, z\right)\right)}\]
  3. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(y, 2, \mathsf{fma}\left(3, x, z\right)\right)\]

Reproduce

herbie shell --seed 2019212 +o rules:numerics
(FPCore (x y z)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendInside from plot-0.2.3.4"
  :precision binary64
  (+ (+ (+ (+ (+ x y) y) x) z) x))