Average Error: 0.1 → 0.1
Time: 17.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 r126657 = x;
        double r126658 = y;
        double r126659 = z;
        double r126660 = r126658 + r126659;
        double r126661 = r126660 + r126659;
        double r126662 = r126661 + r126658;
        double r126663 = t;
        double r126664 = r126662 + r126663;
        double r126665 = r126657 * r126664;
        double r126666 = 5.0;
        double r126667 = r126658 * r126666;
        double r126668 = r126665 + r126667;
        return r126668;
}

double f(double x, double y, double z, double t) {
        double r126669 = x;
        double r126670 = 2.0;
        double r126671 = y;
        double r126672 = z;
        double r126673 = r126671 + r126672;
        double r126674 = t;
        double r126675 = fma(r126670, r126673, r126674);
        double r126676 = 5.0;
        double r126677 = r126671 * r126676;
        double r126678 = fma(r126669, r126675, r126677);
        return r126678;
}

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