Average Error: 1.9 → 2.1
Time: 16.6s
Precision: 64
\[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
\[\begin{array}{l} \mathbf{if}\;y \le -6.633568333968982 \cdot 10^{-165}:\\ \;\;\;\;\left(z \cdot a\right) \cdot b + \left(\left(x + z \cdot y\right) + t \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(b \cdot a\right) + \left(\left(x + z \cdot y\right) + t \cdot a\right)\\ \end{array}\]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\begin{array}{l}
\mathbf{if}\;y \le -6.633568333968982 \cdot 10^{-165}:\\
\;\;\;\;\left(z \cdot a\right) \cdot b + \left(\left(x + z \cdot y\right) + t \cdot a\right)\\

\mathbf{else}:\\
\;\;\;\;z \cdot \left(b \cdot a\right) + \left(\left(x + z \cdot y\right) + t \cdot a\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r29152960 = x;
        double r29152961 = y;
        double r29152962 = z;
        double r29152963 = r29152961 * r29152962;
        double r29152964 = r29152960 + r29152963;
        double r29152965 = t;
        double r29152966 = a;
        double r29152967 = r29152965 * r29152966;
        double r29152968 = r29152964 + r29152967;
        double r29152969 = r29152966 * r29152962;
        double r29152970 = b;
        double r29152971 = r29152969 * r29152970;
        double r29152972 = r29152968 + r29152971;
        return r29152972;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r29152973 = y;
        double r29152974 = -6.633568333968982e-165;
        bool r29152975 = r29152973 <= r29152974;
        double r29152976 = z;
        double r29152977 = a;
        double r29152978 = r29152976 * r29152977;
        double r29152979 = b;
        double r29152980 = r29152978 * r29152979;
        double r29152981 = x;
        double r29152982 = r29152976 * r29152973;
        double r29152983 = r29152981 + r29152982;
        double r29152984 = t;
        double r29152985 = r29152984 * r29152977;
        double r29152986 = r29152983 + r29152985;
        double r29152987 = r29152980 + r29152986;
        double r29152988 = r29152979 * r29152977;
        double r29152989 = r29152976 * r29152988;
        double r29152990 = r29152989 + r29152986;
        double r29152991 = r29152975 ? r29152987 : r29152990;
        return r29152991;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original1.9
Target0.4
Herbie2.1
\[\begin{array}{l} \mathbf{if}\;z \lt -1.1820553527347888 \cdot 10^{+19}:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{elif}\;z \lt 4.7589743188364287 \cdot 10^{-122}:\\ \;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -6.633568333968982e-165

    1. Initial program 1.7

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]

    if -6.633568333968982e-165 < y

    1. Initial program 2.0

      \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\]
    2. Using strategy rm
    3. Applied add-cube-cbrt2.2

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot \color{blue}{\left(\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \sqrt[3]{b}\right)}\]
    4. Applied associate-*r*2.2

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(\left(a \cdot z\right) \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right) \cdot \sqrt[3]{b}}\]
    5. Using strategy rm
    6. Applied associate-*l*2.1

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{\left(a \cdot \left(z \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right)\right)} \cdot \sqrt[3]{b}\]
    7. Using strategy rm
    8. Applied pow12.1

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot \left(z \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right)\right) \cdot \color{blue}{{\left(\sqrt[3]{b}\right)}^{1}}\]
    9. Applied pow12.1

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot \left(z \cdot \left(\sqrt[3]{b} \cdot \color{blue}{{\left(\sqrt[3]{b}\right)}^{1}}\right)\right)\right) \cdot {\left(\sqrt[3]{b}\right)}^{1}\]
    10. Applied pow12.1

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot \left(z \cdot \left(\color{blue}{{\left(\sqrt[3]{b}\right)}^{1}} \cdot {\left(\sqrt[3]{b}\right)}^{1}\right)\right)\right) \cdot {\left(\sqrt[3]{b}\right)}^{1}\]
    11. Applied pow-prod-down2.1

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot \left(z \cdot \color{blue}{{\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)}^{1}}\right)\right) \cdot {\left(\sqrt[3]{b}\right)}^{1}\]
    12. Applied pow12.1

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot \left(\color{blue}{{z}^{1}} \cdot {\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)}^{1}\right)\right) \cdot {\left(\sqrt[3]{b}\right)}^{1}\]
    13. Applied pow-prod-down2.1

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot \color{blue}{{\left(z \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right)}^{1}}\right) \cdot {\left(\sqrt[3]{b}\right)}^{1}\]
    14. Applied pow12.1

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(\color{blue}{{a}^{1}} \cdot {\left(z \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right)}^{1}\right) \cdot {\left(\sqrt[3]{b}\right)}^{1}\]
    15. Applied pow-prod-down2.1

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{{\left(a \cdot \left(z \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right)\right)}^{1}} \cdot {\left(\sqrt[3]{b}\right)}^{1}\]
    16. Applied pow-prod-down2.1

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + \color{blue}{{\left(\left(a \cdot \left(z \cdot \left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right)\right)\right) \cdot \sqrt[3]{b}\right)}^{1}}\]
    17. Simplified2.3

      \[\leadsto \left(\left(x + y \cdot z\right) + t \cdot a\right) + {\color{blue}{\left(z \cdot \left(a \cdot b\right)\right)}}^{1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -6.633568333968982 \cdot 10^{-165}:\\ \;\;\;\;\left(z \cdot a\right) \cdot b + \left(\left(x + z \cdot y\right) + t \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(b \cdot a\right) + \left(\left(x + z \cdot y\right) + t \cdot a\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019163 
(FPCore (x y z t a b)
  :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"

  :herbie-target
  (if (< z -1.1820553527347888e+19) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 4.7589743188364287e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))

  (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))