Average Error: 3.8 → 0.5
Time: 4.5s
Precision: 64
\[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
\[\begin{array}{l} \mathbf{if}\;\left(y \cdot 9\right) \cdot z \le -1.238690280796900705766198006768324442173 \cdot 10^{177}:\\ \;\;\;\;\left(2 \cdot x - {\left(\left(9 \cdot \left(t \cdot y\right)\right) \cdot z\right)}^{1}\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\\ \mathbf{elif}\;\left(y \cdot 9\right) \cdot z \le 9.72585044449842875475358544069428986135 \cdot 10^{252}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot x - 9 \cdot \left(\left(t \cdot z\right) \cdot y\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\\ \end{array}\]
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\begin{array}{l}
\mathbf{if}\;\left(y \cdot 9\right) \cdot z \le -1.238690280796900705766198006768324442173 \cdot 10^{177}:\\
\;\;\;\;\left(2 \cdot x - {\left(\left(9 \cdot \left(t \cdot y\right)\right) \cdot z\right)}^{1}\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\\

\mathbf{elif}\;\left(y \cdot 9\right) \cdot z \le 9.72585044449842875475358544069428986135 \cdot 10^{252}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\

\mathbf{else}:\\
\;\;\;\;\left(2 \cdot x - 9 \cdot \left(\left(t \cdot z\right) \cdot y\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r847870 = x;
        double r847871 = 2.0;
        double r847872 = r847870 * r847871;
        double r847873 = y;
        double r847874 = 9.0;
        double r847875 = r847873 * r847874;
        double r847876 = z;
        double r847877 = r847875 * r847876;
        double r847878 = t;
        double r847879 = r847877 * r847878;
        double r847880 = r847872 - r847879;
        double r847881 = a;
        double r847882 = 27.0;
        double r847883 = r847881 * r847882;
        double r847884 = b;
        double r847885 = r847883 * r847884;
        double r847886 = r847880 + r847885;
        return r847886;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r847887 = y;
        double r847888 = 9.0;
        double r847889 = r847887 * r847888;
        double r847890 = z;
        double r847891 = r847889 * r847890;
        double r847892 = -1.2386902807969007e+177;
        bool r847893 = r847891 <= r847892;
        double r847894 = 2.0;
        double r847895 = x;
        double r847896 = r847894 * r847895;
        double r847897 = t;
        double r847898 = r847897 * r847887;
        double r847899 = r847888 * r847898;
        double r847900 = r847899 * r847890;
        double r847901 = 1.0;
        double r847902 = pow(r847900, r847901);
        double r847903 = r847896 - r847902;
        double r847904 = 27.0;
        double r847905 = a;
        double r847906 = b;
        double r847907 = r847905 * r847906;
        double r847908 = r847904 * r847907;
        double r847909 = pow(r847908, r847901);
        double r847910 = r847903 + r847909;
        double r847911 = 9.725850444498429e+252;
        bool r847912 = r847891 <= r847911;
        double r847913 = r847895 * r847894;
        double r847914 = r847891 * r847897;
        double r847915 = r847913 - r847914;
        double r847916 = r847904 * r847906;
        double r847917 = r847905 * r847916;
        double r847918 = r847915 + r847917;
        double r847919 = r847897 * r847890;
        double r847920 = r847919 * r847887;
        double r847921 = r847888 * r847920;
        double r847922 = r847896 - r847921;
        double r847923 = r847922 + r847909;
        double r847924 = r847912 ? r847918 : r847923;
        double r847925 = r847893 ? r847910 : r847924;
        return r847925;
}

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

Original3.8
Target2.8
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;y \lt 7.590524218811188954625810696587370427881 \cdot 10^{-161}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if (* (* y 9.0) z) < -1.2386902807969007e+177

    1. Initial program 22.4

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    2. Taylor expanded around inf 21.5

      \[\leadsto \color{blue}{\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)} + \left(a \cdot 27\right) \cdot b\]
    3. Using strategy rm
    4. Applied pow121.5

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \left(a \cdot 27\right) \cdot \color{blue}{{b}^{1}}\]
    5. Applied pow121.5

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \left(a \cdot \color{blue}{{27}^{1}}\right) \cdot {b}^{1}\]
    6. Applied pow121.5

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \left(\color{blue}{{a}^{1}} \cdot {27}^{1}\right) \cdot {b}^{1}\]
    7. Applied pow-prod-down21.5

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \color{blue}{{\left(a \cdot 27\right)}^{1}} \cdot {b}^{1}\]
    8. Applied pow-prod-down21.5

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \color{blue}{{\left(\left(a \cdot 27\right) \cdot b\right)}^{1}}\]
    9. Simplified21.4

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + {\color{blue}{\left(27 \cdot \left(a \cdot b\right)\right)}}^{1}\]
    10. Using strategy rm
    11. Applied add-cube-cbrt21.4

      \[\leadsto \left(2 \cdot x - \color{blue}{\left(\left(\sqrt[3]{9} \cdot \sqrt[3]{9}\right) \cdot \sqrt[3]{9}\right)} \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    12. Applied associate-*l*21.4

      \[\leadsto \left(2 \cdot x - \color{blue}{\left(\sqrt[3]{9} \cdot \sqrt[3]{9}\right) \cdot \left(\sqrt[3]{9} \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)}\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    13. Using strategy rm
    14. Applied pow121.4

      \[\leadsto \left(2 \cdot x - \left(\sqrt[3]{9} \cdot \sqrt[3]{9}\right) \cdot \left(\sqrt[3]{9} \cdot \left(t \cdot \left(z \cdot \color{blue}{{y}^{1}}\right)\right)\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    15. Applied pow121.4

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

      \[\leadsto \left(2 \cdot x - \left(\sqrt[3]{9} \cdot \sqrt[3]{9}\right) \cdot \left(\sqrt[3]{9} \cdot \left(t \cdot \color{blue}{{\left(z \cdot y\right)}^{1}}\right)\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    17. Applied pow121.4

      \[\leadsto \left(2 \cdot x - \left(\sqrt[3]{9} \cdot \sqrt[3]{9}\right) \cdot \left(\sqrt[3]{9} \cdot \left(\color{blue}{{t}^{1}} \cdot {\left(z \cdot y\right)}^{1}\right)\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    18. Applied pow-prod-down21.4

      \[\leadsto \left(2 \cdot x - \left(\sqrt[3]{9} \cdot \sqrt[3]{9}\right) \cdot \left(\sqrt[3]{9} \cdot \color{blue}{{\left(t \cdot \left(z \cdot y\right)\right)}^{1}}\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    19. Applied pow121.4

      \[\leadsto \left(2 \cdot x - \left(\sqrt[3]{9} \cdot \sqrt[3]{9}\right) \cdot \left(\color{blue}{{\left(\sqrt[3]{9}\right)}^{1}} \cdot {\left(t \cdot \left(z \cdot y\right)\right)}^{1}\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    20. Applied pow-prod-down21.4

      \[\leadsto \left(2 \cdot x - \left(\sqrt[3]{9} \cdot \sqrt[3]{9}\right) \cdot \color{blue}{{\left(\sqrt[3]{9} \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)}^{1}}\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    21. Applied pow121.4

      \[\leadsto \left(2 \cdot x - \left(\sqrt[3]{9} \cdot \color{blue}{{\left(\sqrt[3]{9}\right)}^{1}}\right) \cdot {\left(\sqrt[3]{9} \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)}^{1}\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    22. Applied pow121.4

      \[\leadsto \left(2 \cdot x - \left(\color{blue}{{\left(\sqrt[3]{9}\right)}^{1}} \cdot {\left(\sqrt[3]{9}\right)}^{1}\right) \cdot {\left(\sqrt[3]{9} \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)}^{1}\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    23. Applied pow-prod-down21.4

      \[\leadsto \left(2 \cdot x - \color{blue}{{\left(\sqrt[3]{9} \cdot \sqrt[3]{9}\right)}^{1}} \cdot {\left(\sqrt[3]{9} \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)}^{1}\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    24. Applied pow-prod-down21.4

      \[\leadsto \left(2 \cdot x - \color{blue}{{\left(\left(\sqrt[3]{9} \cdot \sqrt[3]{9}\right) \cdot \left(\sqrt[3]{9} \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)\right)}^{1}}\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    25. Simplified1.3

      \[\leadsto \left(2 \cdot x - {\color{blue}{\left(\left(9 \cdot \left(t \cdot y\right)\right) \cdot z\right)}}^{1}\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]

    if -1.2386902807969007e+177 < (* (* y 9.0) z) < 9.725850444498429e+252

    1. Initial program 0.4

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    2. Using strategy rm
    3. Applied associate-*l*0.4

      \[\leadsto \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \color{blue}{a \cdot \left(27 \cdot b\right)}\]

    if 9.725850444498429e+252 < (* (* y 9.0) z)

    1. Initial program 39.8

      \[\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\]
    2. Taylor expanded around inf 38.3

      \[\leadsto \color{blue}{\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)} + \left(a \cdot 27\right) \cdot b\]
    3. Using strategy rm
    4. Applied pow138.3

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \left(a \cdot 27\right) \cdot \color{blue}{{b}^{1}}\]
    5. Applied pow138.3

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \left(a \cdot \color{blue}{{27}^{1}}\right) \cdot {b}^{1}\]
    6. Applied pow138.3

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \left(\color{blue}{{a}^{1}} \cdot {27}^{1}\right) \cdot {b}^{1}\]
    7. Applied pow-prod-down38.3

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \color{blue}{{\left(a \cdot 27\right)}^{1}} \cdot {b}^{1}\]
    8. Applied pow-prod-down38.3

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \color{blue}{{\left(\left(a \cdot 27\right) \cdot b\right)}^{1}}\]
    9. Simplified38.3

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + {\color{blue}{\left(27 \cdot \left(a \cdot b\right)\right)}}^{1}\]
    10. Using strategy rm
    11. Applied associate-*r*0.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y \cdot 9\right) \cdot z \le -1.238690280796900705766198006768324442173 \cdot 10^{177}:\\ \;\;\;\;\left(2 \cdot x - {\left(\left(9 \cdot \left(t \cdot y\right)\right) \cdot z\right)}^{1}\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\\ \mathbf{elif}\;\left(y \cdot 9\right) \cdot z \le 9.72585044449842875475358544069428986135 \cdot 10^{252}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot x - 9 \cdot \left(\left(t \cdot z\right) \cdot y\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\\ \end{array}\]

Reproduce

herbie shell --seed 2019353 
(FPCore (x y z t a b)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, A"
  :precision binary64

  :herbie-target
  (if (< y 7.590524218811189e-161) (+ (- (* x 2) (* (* (* y 9) z) t)) (* a (* 27 b))) (+ (- (* x 2) (* 9 (* y (* t z)))) (* (* a 27) b)))

  (+ (- (* x 2) (* (* (* y 9) z) t)) (* (* a 27) b)))