Average Error: 0.1 → 0.1
Time: 18.0s
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 r97807 = x;
        double r97808 = y;
        double r97809 = z;
        double r97810 = r97808 + r97809;
        double r97811 = r97810 + r97809;
        double r97812 = r97811 + r97808;
        double r97813 = t;
        double r97814 = r97812 + r97813;
        double r97815 = r97807 * r97814;
        double r97816 = 5.0;
        double r97817 = r97808 * r97816;
        double r97818 = r97815 + r97817;
        return r97818;
}

double f(double x, double y, double z, double t) {
        double r97819 = x;
        double r97820 = 2.0;
        double r97821 = y;
        double r97822 = z;
        double r97823 = r97821 + r97822;
        double r97824 = t;
        double r97825 = fma(r97820, r97823, r97824);
        double r97826 = 5.0;
        double r97827 = r97821 * r97826;
        double r97828 = fma(r97819, r97825, r97827);
        return r97828;
}

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