Average Error: 0.1 → 0.0
Time: 12.2s
Precision: 64
\[x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5\]
\[\mathsf{fma}\left(y, 5, \mathsf{fma}\left(z + y, 2, t\right) \cdot x\right)\]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\mathsf{fma}\left(y, 5, \mathsf{fma}\left(z + y, 2, t\right) \cdot x\right)
double f(double x, double y, double z, double t) {
        double r160166 = x;
        double r160167 = y;
        double r160168 = z;
        double r160169 = r160167 + r160168;
        double r160170 = r160169 + r160168;
        double r160171 = r160170 + r160167;
        double r160172 = t;
        double r160173 = r160171 + r160172;
        double r160174 = r160166 * r160173;
        double r160175 = 5.0;
        double r160176 = r160167 * r160175;
        double r160177 = r160174 + r160176;
        return r160177;
}

double f(double x, double y, double z, double t) {
        double r160178 = y;
        double r160179 = 5.0;
        double r160180 = z;
        double r160181 = r160180 + r160178;
        double r160182 = 2.0;
        double r160183 = t;
        double r160184 = fma(r160181, r160182, r160183);
        double r160185 = x;
        double r160186 = r160184 * r160185;
        double r160187 = fma(r160178, r160179, r160186);
        return r160187;
}

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.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right)}\]
  3. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(y, 5, \mathsf{fma}\left(z + y, 2, t\right) \cdot x\right)\]

Reproduce

herbie shell --seed 2019194 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
  (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))