Average Error: 0.1 → 0.0
Time: 3.6s
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 r140236 = x;
        double r140237 = y;
        double r140238 = z;
        double r140239 = r140237 + r140238;
        double r140240 = r140239 + r140238;
        double r140241 = r140240 + r140237;
        double r140242 = t;
        double r140243 = r140241 + r140242;
        double r140244 = r140236 * r140243;
        double r140245 = 5.0;
        double r140246 = r140237 * r140245;
        double r140247 = r140244 + r140246;
        return r140247;
}

double f(double x, double y, double z, double t) {
        double r140248 = y;
        double r140249 = z;
        double r140250 = r140248 + r140249;
        double r140251 = x;
        double r140252 = r140251 + r140251;
        double r140253 = 5.0;
        double r140254 = t;
        double r140255 = r140254 * r140251;
        double r140256 = fma(r140253, r140248, r140255);
        double r140257 = fma(r140250, r140252, r140256);
        return r140257;
}

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.0

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

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

Reproduce

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