Average Error: 0.1 → 0.0
Time: 19.0s
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 r200267 = x;
        double r200268 = y;
        double r200269 = r200267 + r200268;
        double r200270 = r200269 + r200268;
        double r200271 = r200270 + r200267;
        double r200272 = z;
        double r200273 = r200271 + r200272;
        double r200274 = r200273 + r200267;
        return r200274;
}

double f(double x, double y, double z) {
        double r200275 = y;
        double r200276 = 2.0;
        double r200277 = 3.0;
        double r200278 = x;
        double r200279 = z;
        double r200280 = fma(r200277, r200278, r200279);
        double r200281 = fma(r200275, r200276, r200280);
        return r200281;
}

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 2019305 +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))