Average Error: 0.1 → 0.1
Time: 16.6s
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 r109624 = x;
        double r109625 = y;
        double r109626 = z;
        double r109627 = r109625 + r109626;
        double r109628 = r109627 + r109626;
        double r109629 = r109628 + r109625;
        double r109630 = t;
        double r109631 = r109629 + r109630;
        double r109632 = r109624 * r109631;
        double r109633 = 5.0;
        double r109634 = r109625 * r109633;
        double r109635 = r109632 + r109634;
        return r109635;
}

double f(double x, double y, double z, double t) {
        double r109636 = x;
        double r109637 = 2.0;
        double r109638 = y;
        double r109639 = z;
        double r109640 = r109638 + r109639;
        double r109641 = t;
        double r109642 = fma(r109637, r109640, r109641);
        double r109643 = 5.0;
        double r109644 = r109638 * r109643;
        double r109645 = fma(r109636, r109642, r109644);
        return r109645;
}

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