Average Error: 4.0 → 1.0
Time: 4.1s
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 -2.37460898105936542 \cdot 10^{120}:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\\ \mathbf{elif}\;\left(y \cdot 9\right) \cdot z \le 9.64921934012514858 \cdot 10^{106}:\\ \;\;\;\;1 \cdot \left(\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + {\left(\sqrt{27} \cdot \left(\sqrt{27} \cdot \left(a \cdot b\right)\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 -2.37460898105936542 \cdot 10^{120}:\\
\;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot z\right) \cdot t\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r826592 = x;
        double r826593 = 2.0;
        double r826594 = r826592 * r826593;
        double r826595 = y;
        double r826596 = 9.0;
        double r826597 = r826595 * r826596;
        double r826598 = z;
        double r826599 = r826597 * r826598;
        double r826600 = t;
        double r826601 = r826599 * r826600;
        double r826602 = r826594 - r826601;
        double r826603 = a;
        double r826604 = 27.0;
        double r826605 = r826603 * r826604;
        double r826606 = b;
        double r826607 = r826605 * r826606;
        double r826608 = r826602 + r826607;
        return r826608;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r826609 = y;
        double r826610 = 9.0;
        double r826611 = r826609 * r826610;
        double r826612 = z;
        double r826613 = r826611 * r826612;
        double r826614 = -2.3746089810593654e+120;
        bool r826615 = r826613 <= r826614;
        double r826616 = x;
        double r826617 = 2.0;
        double r826618 = r826616 * r826617;
        double r826619 = r826610 * r826612;
        double r826620 = t;
        double r826621 = r826619 * r826620;
        double r826622 = r826609 * r826621;
        double r826623 = r826618 - r826622;
        double r826624 = 27.0;
        double r826625 = a;
        double r826626 = b;
        double r826627 = r826625 * r826626;
        double r826628 = r826624 * r826627;
        double r826629 = 1.0;
        double r826630 = pow(r826628, r826629);
        double r826631 = r826623 + r826630;
        double r826632 = 9.649219340125149e+106;
        bool r826633 = r826613 <= r826632;
        double r826634 = r826617 * r826616;
        double r826635 = r826634 + r826628;
        double r826636 = r826612 * r826609;
        double r826637 = r826620 * r826636;
        double r826638 = r826610 * r826637;
        double r826639 = r826635 - r826638;
        double r826640 = r826629 * r826639;
        double r826641 = r826612 * r826620;
        double r826642 = r826611 * r826641;
        double r826643 = r826618 - r826642;
        double r826644 = sqrt(r826624);
        double r826645 = r826644 * r826627;
        double r826646 = r826644 * r826645;
        double r826647 = pow(r826646, r826629);
        double r826648 = r826643 + r826647;
        double r826649 = r826633 ? r826640 : r826648;
        double r826650 = r826615 ? r826631 : r826649;
        return r826650;
}

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

Original4.0
Target2.8
Herbie1.0
\[\begin{array}{l} \mathbf{if}\;y \lt 7.590524218811189 \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) < -2.3746089810593654e+120

    1. Initial program 16.6

      \[\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 pow116.6

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

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

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

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

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

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

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

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

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

    if -2.3746089810593654e+120 < (* (* y 9.0) z) < 9.649219340125149e+106

    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 pow10.4

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

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

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

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

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

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

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

      \[\leadsto \left(x \cdot 2 - \color{blue}{y \cdot \left(9 \cdot \left(z \cdot t\right)\right)}\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\]
    13. Using strategy rm
    14. Applied *-un-lft-identity3.8

      \[\leadsto \left(x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right) + \color{blue}{1 \cdot {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}}\]
    15. Applied *-un-lft-identity3.8

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

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

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

    if 9.649219340125149e+106 < (* (* y 9.0) z)

    1. Initial program 16.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 pow116.4

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

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

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

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2020060 
(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)))