Average Error: 0.1 → 0.1
Time: 10.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 r155491 = x;
        double r155492 = y;
        double r155493 = z;
        double r155494 = r155492 + r155493;
        double r155495 = r155494 + r155493;
        double r155496 = r155495 + r155492;
        double r155497 = t;
        double r155498 = r155496 + r155497;
        double r155499 = r155491 * r155498;
        double r155500 = 5.0;
        double r155501 = r155492 * r155500;
        double r155502 = r155499 + r155501;
        return r155502;
}

double f(double x, double y, double z, double t) {
        double r155503 = x;
        double r155504 = 2.0;
        double r155505 = y;
        double r155506 = z;
        double r155507 = r155505 + r155506;
        double r155508 = t;
        double r155509 = fma(r155504, r155507, r155508);
        double r155510 = 5.0;
        double r155511 = r155505 * r155510;
        double r155512 = fma(r155503, r155509, r155511);
        return r155512;
}

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