Average Error: 0.1 → 0.1
Time: 4.7s
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 r16753 = x;
        double r16754 = y;
        double r16755 = z;
        double r16756 = r16754 + r16755;
        double r16757 = r16756 + r16755;
        double r16758 = r16757 + r16754;
        double r16759 = t;
        double r16760 = r16758 + r16759;
        double r16761 = r16753 * r16760;
        double r16762 = 5.0;
        double r16763 = r16754 * r16762;
        double r16764 = r16761 + r16763;
        return r16764;
}

double f(double x, double y, double z, double t) {
        double r16765 = x;
        double r16766 = 2.0;
        double r16767 = y;
        double r16768 = z;
        double r16769 = r16767 + r16768;
        double r16770 = t;
        double r16771 = fma(r16766, r16769, r16770);
        double r16772 = 5.0;
        double r16773 = r16767 * r16772;
        double r16774 = fma(r16765, r16771, r16773);
        return r16774;
}

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