Average Error: 0.1 → 0.1
Time: 5.1s
Precision: 64
\[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5\]
\[\mathsf{fma}\left(y + z, x + x, \mathsf{fma}\left(5, y, t \cdot x\right)\right)\]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\mathsf{fma}\left(y + z, x + x, \mathsf{fma}\left(5, y, t \cdot x\right)\right)
double f(double x, double y, double z, double t) {
        double r152883 = x;
        double r152884 = y;
        double r152885 = z;
        double r152886 = r152884 + r152885;
        double r152887 = r152886 + r152885;
        double r152888 = r152887 + r152884;
        double r152889 = t;
        double r152890 = r152888 + r152889;
        double r152891 = r152883 * r152890;
        double r152892 = 5.0;
        double r152893 = r152884 * r152892;
        double r152894 = r152891 + r152893;
        return r152894;
}

double f(double x, double y, double z, double t) {
        double r152895 = y;
        double r152896 = z;
        double r152897 = r152895 + r152896;
        double r152898 = x;
        double r152899 = r152898 + r152898;
        double r152900 = 5.0;
        double r152901 = t;
        double r152902 = r152901 * r152898;
        double r152903 = fma(r152900, r152895, r152902);
        double r152904 = fma(r152897, r152899, r152903);
        return r152904;
}

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(y + z, x + x, \mathsf{fma}\left(t, x, y \cdot 5\right)\right)}\]
  3. Taylor expanded around 0 0.1

    \[\leadsto \mathsf{fma}\left(y + z, x + x, \color{blue}{5 \cdot y + t \cdot x}\right)\]
  4. Simplified0.1

    \[\leadsto \mathsf{fma}\left(y + z, x + x, \color{blue}{\mathsf{fma}\left(5, y, t \cdot x\right)}\right)\]
  5. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(y + z, x + x, \mathsf{fma}\left(5, y, t \cdot x\right)\right)\]

Reproduce

herbie shell --seed 2020064 +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)))