Average Error: 3.8 → 0.5
Time: 4.3s
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) + 27 \cdot \left(a \cdot b\right)\\ \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) + 27 \cdot \left(a \cdot b\right)\\ \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) + 27 \cdot \left(a \cdot b\right)\\

\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) + 27 \cdot \left(a \cdot b\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r1020961 = x;
        double r1020962 = 2.0;
        double r1020963 = r1020961 * r1020962;
        double r1020964 = y;
        double r1020965 = 9.0;
        double r1020966 = r1020964 * r1020965;
        double r1020967 = z;
        double r1020968 = r1020966 * r1020967;
        double r1020969 = t;
        double r1020970 = r1020968 * r1020969;
        double r1020971 = r1020963 - r1020970;
        double r1020972 = a;
        double r1020973 = 27.0;
        double r1020974 = r1020972 * r1020973;
        double r1020975 = b;
        double r1020976 = r1020974 * r1020975;
        double r1020977 = r1020971 + r1020976;
        return r1020977;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1020978 = y;
        double r1020979 = 9.0;
        double r1020980 = r1020978 * r1020979;
        double r1020981 = z;
        double r1020982 = r1020980 * r1020981;
        double r1020983 = -1.2386902807969007e+177;
        bool r1020984 = r1020982 <= r1020983;
        double r1020985 = 2.0;
        double r1020986 = x;
        double r1020987 = r1020985 * r1020986;
        double r1020988 = t;
        double r1020989 = r1020988 * r1020978;
        double r1020990 = r1020979 * r1020989;
        double r1020991 = r1020990 * r1020981;
        double r1020992 = 1.0;
        double r1020993 = pow(r1020991, r1020992);
        double r1020994 = r1020987 - r1020993;
        double r1020995 = 27.0;
        double r1020996 = a;
        double r1020997 = b;
        double r1020998 = r1020996 * r1020997;
        double r1020999 = r1020995 * r1020998;
        double r1021000 = r1020994 + r1020999;
        double r1021001 = 9.725850444498429e+252;
        bool r1021002 = r1020982 <= r1021001;
        double r1021003 = r1020986 * r1020985;
        double r1021004 = r1020982 * r1020988;
        double r1021005 = r1021003 - r1021004;
        double r1021006 = r1020995 * r1020997;
        double r1021007 = r1020996 * r1021006;
        double r1021008 = r1021005 + r1021007;
        double r1021009 = r1020988 * r1020981;
        double r1021010 = r1021009 * r1020978;
        double r1021011 = r1020979 * r1021010;
        double r1021012 = r1020987 - r1021011;
        double r1021013 = r1021012 + r1020999;
        double r1021014 = r1021002 ? r1021008 : r1021013;
        double r1021015 = r1020984 ? r1021000 : r1021014;
        return r1021015;
}

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. Taylor expanded around 0 21.4

      \[\leadsto \left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + \color{blue}{27 \cdot \left(a \cdot b\right)}\]
    4. Using strategy rm
    5. 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) + 27 \cdot \left(a \cdot b\right)\]
    6. 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) + 27 \cdot \left(a \cdot b\right)\]
    7. Using strategy rm
    8. 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) + 27 \cdot \left(a \cdot b\right)\]
    9. 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) + 27 \cdot \left(a \cdot b\right)\]
    10. 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) + 27 \cdot \left(a \cdot b\right)\]
    11. 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) + 27 \cdot \left(a \cdot b\right)\]
    12. 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) + 27 \cdot \left(a \cdot b\right)\]
    13. 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) + 27 \cdot \left(a \cdot b\right)\]
    14. 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) + 27 \cdot \left(a \cdot b\right)\]
    15. 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) + 27 \cdot \left(a \cdot b\right)\]
    16. 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) + 27 \cdot \left(a \cdot b\right)\]
    17. 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) + 27 \cdot \left(a \cdot b\right)\]
    18. 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) + 27 \cdot \left(a \cdot b\right)\]
    19. Simplified1.3

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

    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. Taylor expanded around 0 38.3

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

      \[\leadsto \left(2 \cdot x - 9 \cdot \color{blue}{\left(\left(t \cdot z\right) \cdot y\right)}\right) + 27 \cdot \left(a \cdot b\right)\]
  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) + 27 \cdot \left(a \cdot b\right)\\ \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) + 27 \cdot \left(a \cdot b\right)\\ \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)))