Average Error: 0.1 → 0.1
Time: 20.3s
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 r135687 = x;
        double r135688 = y;
        double r135689 = z;
        double r135690 = r135688 + r135689;
        double r135691 = r135690 + r135689;
        double r135692 = r135691 + r135688;
        double r135693 = t;
        double r135694 = r135692 + r135693;
        double r135695 = r135687 * r135694;
        double r135696 = 5.0;
        double r135697 = r135688 * r135696;
        double r135698 = r135695 + r135697;
        return r135698;
}

double f(double x, double y, double z, double t) {
        double r135699 = x;
        double r135700 = 2.0;
        double r135701 = y;
        double r135702 = z;
        double r135703 = r135701 + r135702;
        double r135704 = t;
        double r135705 = fma(r135700, r135703, r135704);
        double r135706 = 5.0;
        double r135707 = r135701 * r135706;
        double r135708 = fma(r135699, r135705, r135707);
        return r135708;
}

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