Average Error: 0.1 → 0.0
Time: 9.4s
Precision: 64
\[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x\]
\[\mathsf{fma}\left(y, 2, \mathsf{fma}\left(3, x, z\right)\right)\]
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x
\mathsf{fma}\left(y, 2, \mathsf{fma}\left(3, x, z\right)\right)
double f(double x, double y, double z) {
        double r149826 = x;
        double r149827 = y;
        double r149828 = r149826 + r149827;
        double r149829 = r149828 + r149827;
        double r149830 = r149829 + r149826;
        double r149831 = z;
        double r149832 = r149830 + r149831;
        double r149833 = r149832 + r149826;
        return r149833;
}

double f(double x, double y, double z) {
        double r149834 = y;
        double r149835 = 2.0;
        double r149836 = 3.0;
        double r149837 = x;
        double r149838 = z;
        double r149839 = fma(r149836, r149837, r149838);
        double r149840 = fma(r149834, r149835, r149839);
        return r149840;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.1

    \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x\]
  2. Simplified0.0

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

    \[\leadsto \mathsf{fma}\left(y, 2, \mathsf{fma}\left(3, x, z\right)\right)\]

Reproduce

herbie shell --seed 2020043 +o rules:numerics
(FPCore (x y z)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendInside from plot-0.2.3.4"
  :precision binary64
  (+ (+ (+ (+ (+ x y) y) x) z) x))