Average Error: 0.1 → 0.1
Time: 25.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 r141997 = x;
        double r141998 = y;
        double r141999 = z;
        double r142000 = r141998 + r141999;
        double r142001 = r142000 + r141999;
        double r142002 = r142001 + r141998;
        double r142003 = t;
        double r142004 = r142002 + r142003;
        double r142005 = r141997 * r142004;
        double r142006 = 5.0;
        double r142007 = r141998 * r142006;
        double r142008 = r142005 + r142007;
        return r142008;
}

double f(double x, double y, double z, double t) {
        double r142009 = x;
        double r142010 = 2.0;
        double r142011 = y;
        double r142012 = z;
        double r142013 = r142011 + r142012;
        double r142014 = t;
        double r142015 = fma(r142010, r142013, r142014);
        double r142016 = 5.0;
        double r142017 = r142011 * r142016;
        double r142018 = fma(r142009, r142015, r142017);
        return r142018;
}

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 2019199 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
  (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))