Average Error: 3.5 → 1.4
Time: 13.7s
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}\;t \le -5.676106603176618479833130858551602850216 \cdot 10^{-187}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{elif}\;t \le 6.09835887199337102189769286793387544193 \cdot 10^{-79}:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(z \cdot 9\right) \cdot t\right)\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot \left(z \cdot 9\right)\right) \cdot t\right) + \sqrt{27} \cdot \left(\left(\sqrt{27} \cdot a\right) \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}\;t \le -5.676106603176618479833130858551602850216 \cdot 10^{-187}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r628397 = x;
        double r628398 = 2.0;
        double r628399 = r628397 * r628398;
        double r628400 = y;
        double r628401 = 9.0;
        double r628402 = r628400 * r628401;
        double r628403 = z;
        double r628404 = r628402 * r628403;
        double r628405 = t;
        double r628406 = r628404 * r628405;
        double r628407 = r628399 - r628406;
        double r628408 = a;
        double r628409 = 27.0;
        double r628410 = r628408 * r628409;
        double r628411 = b;
        double r628412 = r628410 * r628411;
        double r628413 = r628407 + r628412;
        return r628413;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r628414 = t;
        double r628415 = -5.676106603176618e-187;
        bool r628416 = r628414 <= r628415;
        double r628417 = x;
        double r628418 = 2.0;
        double r628419 = r628417 * r628418;
        double r628420 = y;
        double r628421 = 9.0;
        double r628422 = r628420 * r628421;
        double r628423 = z;
        double r628424 = r628422 * r628423;
        double r628425 = r628424 * r628414;
        double r628426 = r628419 - r628425;
        double r628427 = a;
        double r628428 = 27.0;
        double r628429 = b;
        double r628430 = r628428 * r628429;
        double r628431 = r628427 * r628430;
        double r628432 = r628426 + r628431;
        double r628433 = 6.098358871993371e-79;
        bool r628434 = r628414 <= r628433;
        double r628435 = r628423 * r628421;
        double r628436 = r628435 * r628414;
        double r628437 = r628420 * r628436;
        double r628438 = r628419 - r628437;
        double r628439 = r628427 * r628428;
        double r628440 = r628439 * r628429;
        double r628441 = r628438 + r628440;
        double r628442 = r628420 * r628435;
        double r628443 = r628442 * r628414;
        double r628444 = r628419 - r628443;
        double r628445 = sqrt(r628428);
        double r628446 = r628445 * r628427;
        double r628447 = r628446 * r628429;
        double r628448 = r628445 * r628447;
        double r628449 = r628444 + r628448;
        double r628450 = r628434 ? r628441 : r628449;
        double r628451 = r628416 ? r628432 : r628450;
        return r628451;
}

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.6
Herbie1.4
\[\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 t < -5.676106603176618e-187

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

    if -5.676106603176618e-187 < t < 6.098358871993371e-79

    1. Initial program 7.1

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

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

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

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

    if 6.098358871993371e-79 < t

    1. Initial program 1.2

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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