Average Error: 0.1 → 0.1
Time: 13.5s
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 r6744340 = x;
        double r6744341 = y;
        double r6744342 = z;
        double r6744343 = r6744341 + r6744342;
        double r6744344 = r6744343 + r6744342;
        double r6744345 = r6744344 + r6744341;
        double r6744346 = t;
        double r6744347 = r6744345 + r6744346;
        double r6744348 = r6744340 * r6744347;
        double r6744349 = 5.0;
        double r6744350 = r6744341 * r6744349;
        double r6744351 = r6744348 + r6744350;
        return r6744351;
}

double f(double x, double y, double z, double t) {
        double r6744352 = y;
        double r6744353 = 5.0;
        double r6744354 = z;
        double r6744355 = r6744354 + r6744352;
        double r6744356 = 2.0;
        double r6744357 = t;
        double r6744358 = fma(r6744355, r6744356, r6744357);
        double r6744359 = x;
        double r6744360 = r6744358 * r6744359;
        double r6744361 = fma(r6744352, r6744353, r6744360);
        return r6744361;
}

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(y, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right)}\]
  3. Final simplification0.1

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

Reproduce

herbie shell --seed 2019172 +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)))