Average Error: 0.1 → 0.0
Time: 12.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, x \cdot t + \left(\left(z + y\right) \cdot 2\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, x \cdot t + \left(\left(z + y\right) \cdot 2\right) \cdot x\right)
double f(double x, double y, double z, double t) {
        double r7210607 = x;
        double r7210608 = y;
        double r7210609 = z;
        double r7210610 = r7210608 + r7210609;
        double r7210611 = r7210610 + r7210609;
        double r7210612 = r7210611 + r7210608;
        double r7210613 = t;
        double r7210614 = r7210612 + r7210613;
        double r7210615 = r7210607 * r7210614;
        double r7210616 = 5.0;
        double r7210617 = r7210608 * r7210616;
        double r7210618 = r7210615 + r7210617;
        return r7210618;
}

double f(double x, double y, double z, double t) {
        double r7210619 = y;
        double r7210620 = 5.0;
        double r7210621 = x;
        double r7210622 = t;
        double r7210623 = r7210621 * r7210622;
        double r7210624 = z;
        double r7210625 = r7210624 + r7210619;
        double r7210626 = 2.0;
        double r7210627 = r7210625 * r7210626;
        double r7210628 = r7210627 * r7210621;
        double r7210629 = r7210623 + r7210628;
        double r7210630 = fma(r7210619, r7210620, r7210629);
        return r7210630;
}

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. Using strategy rm
  4. Applied fma-udef0.0

    \[\leadsto \mathsf{fma}\left(y, 5, x \cdot \color{blue}{\left(\left(y + z\right) \cdot 2 + t\right)}\right)\]
  5. Applied distribute-lft-in0.0

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

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

Reproduce

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