Average Error: 0.1 → 0.1
Time: 4.1s
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 r161112 = x;
        double r161113 = y;
        double r161114 = z;
        double r161115 = r161113 + r161114;
        double r161116 = r161115 + r161114;
        double r161117 = r161116 + r161113;
        double r161118 = t;
        double r161119 = r161117 + r161118;
        double r161120 = r161112 * r161119;
        double r161121 = 5.0;
        double r161122 = r161113 * r161121;
        double r161123 = r161120 + r161122;
        return r161123;
}

double f(double x, double y, double z, double t) {
        double r161124 = x;
        double r161125 = 2.0;
        double r161126 = y;
        double r161127 = z;
        double r161128 = r161126 + r161127;
        double r161129 = t;
        double r161130 = fma(r161125, r161128, r161129);
        double r161131 = 5.0;
        double r161132 = r161126 * r161131;
        double r161133 = fma(r161124, r161130, r161132);
        return r161133;
}

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