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 r33499240 = x;
        double r33499241 = y;
        double r33499242 = z;
        double r33499243 = r33499241 * r33499242;
        double r33499244 = r33499240 + r33499243;
        double r33499245 = t;
        double r33499246 = a;
        double r33499247 = r33499245 * r33499246;
        double r33499248 = r33499244 + r33499247;
        double r33499249 = r33499246 * r33499242;
        double r33499250 = b;
        double r33499251 = r33499249 * r33499250;
        double r33499252 = r33499248 + r33499251;
        return r33499252;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r33499253 = y;
        double r33499254 = -6.633568333968982e-165;
        bool r33499255 = r33499253 <= r33499254;
        double r33499256 = z;
        double r33499257 = a;
        double r33499258 = r33499256 * r33499257;
        double r33499259 = b;
        double r33499260 = r33499258 * r33499259;
        double r33499261 = x;
        double r33499262 = r33499256 * r33499253;
        double r33499263 = r33499261 + r33499262;
        double r33499264 = t;
        double r33499265 = r33499264 * r33499257;
        double r33499266 = r33499263 + r33499265;
        double r33499267 = r33499260 + r33499266;
        double r33499268 = r33499259 * r33499257;
        double r33499269 = r33499256 * r33499268;
        double r33499270 = r33499269 + r33499266;
        double r33499271 = r33499255 ? r33499267 : r33499270;
        return r33499271;
}

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)))