Average Error: 0.1 → 0.1
Time: 12.5s
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 r193684 = x;
        double r193685 = y;
        double r193686 = z;
        double r193687 = r193685 + r193686;
        double r193688 = r193687 + r193686;
        double r193689 = r193688 + r193685;
        double r193690 = t;
        double r193691 = r193689 + r193690;
        double r193692 = r193684 * r193691;
        double r193693 = 5.0;
        double r193694 = r193685 * r193693;
        double r193695 = r193692 + r193694;
        return r193695;
}

double f(double x, double y, double z, double t) {
        double r193696 = x;
        double r193697 = 2.0;
        double r193698 = y;
        double r193699 = z;
        double r193700 = r193698 + r193699;
        double r193701 = t;
        double r193702 = fma(r193697, r193700, r193701);
        double r193703 = 5.0;
        double r193704 = r193698 * r193703;
        double r193705 = fma(r193696, r193702, r193704);
        return r193705;
}

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