Average Error: 0.1 → 0.1
Time: 15.9s
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 r88353 = x;
        double r88354 = y;
        double r88355 = z;
        double r88356 = r88354 + r88355;
        double r88357 = r88356 + r88355;
        double r88358 = r88357 + r88354;
        double r88359 = t;
        double r88360 = r88358 + r88359;
        double r88361 = r88353 * r88360;
        double r88362 = 5.0;
        double r88363 = r88354 * r88362;
        double r88364 = r88361 + r88363;
        return r88364;
}

double f(double x, double y, double z, double t) {
        double r88365 = x;
        double r88366 = 2.0;
        double r88367 = y;
        double r88368 = z;
        double r88369 = r88367 + r88368;
        double r88370 = t;
        double r88371 = fma(r88366, r88369, r88370);
        double r88372 = 5.0;
        double r88373 = r88367 * r88372;
        double r88374 = fma(r88365, r88371, r88373);
        return r88374;
}

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