Average Error: 0.1 → 0.0
Time: 15.3s
Precision: 64
\[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x\]
\[\mathsf{fma}\left(2, y, \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(2, y, \mathsf{fma}\left(3, x, z\right)\right)
double f(double x, double y, double z) {
        double r11269256 = x;
        double r11269257 = y;
        double r11269258 = r11269256 + r11269257;
        double r11269259 = r11269258 + r11269257;
        double r11269260 = r11269259 + r11269256;
        double r11269261 = z;
        double r11269262 = r11269260 + r11269261;
        double r11269263 = r11269262 + r11269256;
        return r11269263;
}

double f(double x, double y, double z) {
        double r11269264 = 2.0;
        double r11269265 = y;
        double r11269266 = 3.0;
        double r11269267 = x;
        double r11269268 = z;
        double r11269269 = fma(r11269266, r11269267, r11269268);
        double r11269270 = fma(r11269264, r11269265, r11269269);
        return r11269270;
}

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(2, y, \mathsf{fma}\left(3, x, z\right)\right)}\]
  3. Final simplification0.0

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

Reproduce

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