Average Error: 0.1 → 0.1
Time: 24.2s
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 r110408 = x;
        double r110409 = y;
        double r110410 = z;
        double r110411 = r110409 + r110410;
        double r110412 = r110411 + r110410;
        double r110413 = r110412 + r110409;
        double r110414 = t;
        double r110415 = r110413 + r110414;
        double r110416 = r110408 * r110415;
        double r110417 = 5.0;
        double r110418 = r110409 * r110417;
        double r110419 = r110416 + r110418;
        return r110419;
}

double f(double x, double y, double z, double t) {
        double r110420 = x;
        double r110421 = 2.0;
        double r110422 = y;
        double r110423 = z;
        double r110424 = r110422 + r110423;
        double r110425 = t;
        double r110426 = fma(r110421, r110424, r110425);
        double r110427 = 5.0;
        double r110428 = r110422 * r110427;
        double r110429 = fma(r110420, r110426, r110428);
        return r110429;
}

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