Average Error: 0.1 → 0.1
Time: 12.7s
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 r153577 = x;
        double r153578 = y;
        double r153579 = z;
        double r153580 = r153578 + r153579;
        double r153581 = r153580 + r153579;
        double r153582 = r153581 + r153578;
        double r153583 = t;
        double r153584 = r153582 + r153583;
        double r153585 = r153577 * r153584;
        double r153586 = 5.0;
        double r153587 = r153578 * r153586;
        double r153588 = r153585 + r153587;
        return r153588;
}

double f(double x, double y, double z, double t) {
        double r153589 = x;
        double r153590 = 2.0;
        double r153591 = y;
        double r153592 = z;
        double r153593 = r153591 + r153592;
        double r153594 = t;
        double r153595 = fma(r153590, r153593, r153594);
        double r153596 = 5.0;
        double r153597 = r153591 * r153596;
        double r153598 = fma(r153589, r153595, r153597);
        return r153598;
}

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