Average Error: 3.5 → 0.6
Time: 3.8s
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 = -\infty:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{elif}\;\left(y \cdot 9\right) \cdot z \le 2.84610164995187522 \cdot 10^{153}:\\ \;\;\;\;\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\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 = -\infty:\\
\;\;\;\;\left(x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right) + a \cdot \left(27 \cdot b\right)\\

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

\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\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 r733622 = x;
        double r733623 = 2.0;
        double r733624 = r733622 * r733623;
        double r733625 = y;
        double r733626 = 9.0;
        double r733627 = r733625 * r733626;
        double r733628 = z;
        double r733629 = r733627 * r733628;
        double r733630 = t;
        double r733631 = r733629 * r733630;
        double r733632 = r733624 - r733631;
        double r733633 = a;
        double r733634 = 27.0;
        double r733635 = r733633 * r733634;
        double r733636 = b;
        double r733637 = r733635 * r733636;
        double r733638 = r733632 + r733637;
        return r733638;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r733639 = y;
        double r733640 = 9.0;
        double r733641 = r733639 * r733640;
        double r733642 = z;
        double r733643 = r733641 * r733642;
        double r733644 = -inf.0;
        bool r733645 = r733643 <= r733644;
        double r733646 = x;
        double r733647 = 2.0;
        double r733648 = r733646 * r733647;
        double r733649 = t;
        double r733650 = r733642 * r733649;
        double r733651 = r733640 * r733650;
        double r733652 = r733639 * r733651;
        double r733653 = r733648 - r733652;
        double r733654 = a;
        double r733655 = 27.0;
        double r733656 = b;
        double r733657 = r733655 * r733656;
        double r733658 = r733654 * r733657;
        double r733659 = r733653 + r733658;
        double r733660 = 2.8461016499518752e+153;
        bool r733661 = r733643 <= r733660;
        double r733662 = r733647 * r733646;
        double r733663 = r733642 * r733639;
        double r733664 = r733649 * r733663;
        double r733665 = r733640 * r733664;
        double r733666 = r733662 - r733665;
        double r733667 = r733666 + r733658;
        double r733668 = r733641 * r733650;
        double r733669 = r733648 - r733668;
        double r733670 = r733654 * r733656;
        double r733671 = r733655 * r733670;
        double r733672 = r733669 + r733671;
        double r733673 = r733661 ? r733667 : r733672;
        double r733674 = r733645 ? r733659 : r733673;
        return r733674;
}

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.5
Target2.3
Herbie0.6
\[\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) < -inf.0

    1. Initial program 64.0

      \[\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*2.0

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

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

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

    if -inf.0 < (* (* y 9.0) z) < 2.8461016499518752e+153

    1. Initial program 0.5

      \[\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*3.7

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

      \[\leadsto \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \color{blue}{a \cdot \left(27 \cdot b\right)}\]
    6. Taylor expanded around inf 0.5

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

    if 2.8461016499518752e+153 < (* (* y 9.0) z)

    1. Initial program 19.0

      \[\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*2.0

      \[\leadsto \left(x \cdot 2 - \color{blue}{\left(y \cdot 9\right) \cdot \left(z \cdot t\right)}\right) + \left(a \cdot 27\right) \cdot b\]
    4. Taylor expanded around 0 1.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y \cdot 9\right) \cdot z = -\infty:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{elif}\;\left(y \cdot 9\right) \cdot z \le 2.84610164995187522 \cdot 10^{153}:\\ \;\;\;\;\left(2 \cdot x - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + 27 \cdot \left(a \cdot b\right)\\ \end{array}\]

Reproduce

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