Average Error: 0.1 → 0.1
Time: 4.5s
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 r14326 = x;
        double r14327 = y;
        double r14328 = z;
        double r14329 = r14327 + r14328;
        double r14330 = r14329 + r14328;
        double r14331 = r14330 + r14327;
        double r14332 = t;
        double r14333 = r14331 + r14332;
        double r14334 = r14326 * r14333;
        double r14335 = 5.0;
        double r14336 = r14327 * r14335;
        double r14337 = r14334 + r14336;
        return r14337;
}

double f(double x, double y, double z, double t) {
        double r14338 = x;
        double r14339 = 2.0;
        double r14340 = y;
        double r14341 = z;
        double r14342 = r14340 + r14341;
        double r14343 = t;
        double r14344 = fma(r14339, r14342, r14343);
        double r14345 = 5.0;
        double r14346 = r14340 * r14345;
        double r14347 = fma(r14338, r14344, r14346);
        return r14347;
}

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