Average Error: 0.1 → 0.1
Time: 18.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 r174819 = x;
        double r174820 = y;
        double r174821 = z;
        double r174822 = r174820 + r174821;
        double r174823 = r174822 + r174821;
        double r174824 = r174823 + r174820;
        double r174825 = t;
        double r174826 = r174824 + r174825;
        double r174827 = r174819 * r174826;
        double r174828 = 5.0;
        double r174829 = r174820 * r174828;
        double r174830 = r174827 + r174829;
        return r174830;
}

double f(double x, double y, double z, double t) {
        double r174831 = x;
        double r174832 = 2.0;
        double r174833 = y;
        double r174834 = z;
        double r174835 = r174833 + r174834;
        double r174836 = t;
        double r174837 = fma(r174832, r174835, r174836);
        double r174838 = 5.0;
        double r174839 = r174833 * r174838;
        double r174840 = fma(r174831, r174837, r174839);
        return r174840;
}

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