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 r169768 = x;
        double r169769 = y;
        double r169770 = z;
        double r169771 = r169769 + r169770;
        double r169772 = r169771 + r169770;
        double r169773 = r169772 + r169769;
        double r169774 = t;
        double r169775 = r169773 + r169774;
        double r169776 = r169768 * r169775;
        double r169777 = 5.0;
        double r169778 = r169769 * r169777;
        double r169779 = r169776 + r169778;
        return r169779;
}

double f(double x, double y, double z, double t) {
        double r169780 = x;
        double r169781 = 2.0;
        double r169782 = y;
        double r169783 = z;
        double r169784 = r169782 + r169783;
        double r169785 = t;
        double r169786 = fma(r169781, r169784, r169785);
        double r169787 = 5.0;
        double r169788 = r169782 * r169787;
        double r169789 = fma(r169780, r169786, r169788);
        return r169789;
}

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