Average Error: 0.1 → 0.1
Time: 15.4s
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 r111313 = x;
        double r111314 = y;
        double r111315 = z;
        double r111316 = r111314 + r111315;
        double r111317 = r111316 + r111315;
        double r111318 = r111317 + r111314;
        double r111319 = t;
        double r111320 = r111318 + r111319;
        double r111321 = r111313 * r111320;
        double r111322 = 5.0;
        double r111323 = r111314 * r111322;
        double r111324 = r111321 + r111323;
        return r111324;
}

double f(double x, double y, double z, double t) {
        double r111325 = x;
        double r111326 = 2.0;
        double r111327 = y;
        double r111328 = z;
        double r111329 = r111327 + r111328;
        double r111330 = t;
        double r111331 = fma(r111326, r111329, r111330);
        double r111332 = 5.0;
        double r111333 = r111327 * r111332;
        double r111334 = fma(r111325, r111331, r111333);
        return r111334;
}

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