Average Error: 0.1 → 0.1
Time: 35.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, x \cdot \left(2 \cdot \left(y + z\right)\right)\right) + x \cdot t\]
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 \left(2 \cdot \left(y + z\right)\right)\right) + x \cdot t
double f(double x, double y, double z, double t) {
        double r5473929 = x;
        double r5473930 = y;
        double r5473931 = z;
        double r5473932 = r5473930 + r5473931;
        double r5473933 = r5473932 + r5473931;
        double r5473934 = r5473933 + r5473930;
        double r5473935 = t;
        double r5473936 = r5473934 + r5473935;
        double r5473937 = r5473929 * r5473936;
        double r5473938 = 5.0;
        double r5473939 = r5473930 * r5473938;
        double r5473940 = r5473937 + r5473939;
        return r5473940;
}

double f(double x, double y, double z, double t) {
        double r5473941 = y;
        double r5473942 = 5.0;
        double r5473943 = x;
        double r5473944 = 2.0;
        double r5473945 = z;
        double r5473946 = r5473941 + r5473945;
        double r5473947 = r5473944 * r5473946;
        double r5473948 = r5473943 * r5473947;
        double r5473949 = fma(r5473941, r5473942, r5473948);
        double r5473950 = t;
        double r5473951 = r5473943 * r5473950;
        double r5473952 = r5473949 + r5473951;
        return r5473952;
}

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(\mathsf{fma}\left(y + z, 2, t\right), x, y \cdot 5\right)}\]
  3. Using strategy rm
  4. Applied fma-udef0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(y + z, 2, t\right) \cdot x + y \cdot 5}\]
  5. Taylor expanded around inf 0.1

    \[\leadsto \color{blue}{\left(2 \cdot \left(x \cdot z\right) + \left(t \cdot x + 2 \cdot \left(x \cdot y\right)\right)\right)} + y \cdot 5\]
  6. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, t, x \cdot \left(\left(z + y\right) \cdot 2\right)\right)} + y \cdot 5\]
  7. Using strategy rm
  8. Applied fma-udef0.1

    \[\leadsto \color{blue}{\left(x \cdot t + x \cdot \left(\left(z + y\right) \cdot 2\right)\right)} + y \cdot 5\]
  9. Applied associate-+l+0.1

    \[\leadsto \color{blue}{x \cdot t + \left(x \cdot \left(\left(z + y\right) \cdot 2\right) + y \cdot 5\right)}\]
  10. Simplified0.1

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

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

Reproduce

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