Average Error: 0.1 → 0.0
Time: 11.8s
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, t \cdot x + \left(\left(z + y\right) \cdot x\right) \cdot 2\right)\]
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\mathsf{fma}\left(y, 5, t \cdot x + \left(\left(z + y\right) \cdot x\right) \cdot 2\right)
double f(double x, double y, double z, double t) {
        double r111779 = x;
        double r111780 = y;
        double r111781 = z;
        double r111782 = r111780 + r111781;
        double r111783 = r111782 + r111781;
        double r111784 = r111783 + r111780;
        double r111785 = t;
        double r111786 = r111784 + r111785;
        double r111787 = r111779 * r111786;
        double r111788 = 5.0;
        double r111789 = r111780 * r111788;
        double r111790 = r111787 + r111789;
        return r111790;
}

double f(double x, double y, double z, double t) {
        double r111791 = y;
        double r111792 = 5.0;
        double r111793 = t;
        double r111794 = x;
        double r111795 = r111793 * r111794;
        double r111796 = z;
        double r111797 = r111796 + r111791;
        double r111798 = r111797 * r111794;
        double r111799 = 2.0;
        double r111800 = r111798 * r111799;
        double r111801 = r111795 + r111800;
        double r111802 = fma(r111791, r111792, r111801);
        return r111802;
}

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

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

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

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

Reproduce

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