Average Error: 0.1 → 0.1
Time: 11.1s
Precision: 64
\[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5\]
\[\mathsf{fma}\left(x, \mathsf{fma}\left(2, y + z, t\right), y \cdot 5\right)\]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\mathsf{fma}\left(x, \mathsf{fma}\left(2, y + z, t\right), y \cdot 5\right)
double f(double x, double y, double z, double t) {
        double r163606 = x;
        double r163607 = y;
        double r163608 = z;
        double r163609 = r163607 + r163608;
        double r163610 = r163609 + r163608;
        double r163611 = r163610 + r163607;
        double r163612 = t;
        double r163613 = r163611 + r163612;
        double r163614 = r163606 * r163613;
        double r163615 = 5.0;
        double r163616 = r163607 * r163615;
        double r163617 = r163614 + r163616;
        return r163617;
}

double f(double x, double y, double z, double t) {
        double r163618 = x;
        double r163619 = 2.0;
        double r163620 = y;
        double r163621 = z;
        double r163622 = r163620 + r163621;
        double r163623 = t;
        double r163624 = fma(r163619, r163622, r163623);
        double r163625 = 5.0;
        double r163626 = r163620 * r163625;
        double r163627 = fma(r163618, r163624, r163626);
        return r163627;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Derivation

  1. Initial program 0.1

    \[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5\]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(2, y + z, t\right), y \cdot 5\right)}\]
  3. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(2, y + z, t\right), y \cdot 5\right)\]

Reproduce

herbie shell --seed 2020046 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
  :precision binary64
  (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5)))