Average Error: 3.7 → 0.7
Time: 9.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}\;t \le -1.704208961297091951604042405559569348925 \cdot 10^{59}:\\ \;\;\;\;\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \mathbf{elif}\;t \le 5.916611549783385719963359206108322041473 \cdot 10^{-6}:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot t\right) \cdot z\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) + \left(a \cdot 27\right) \cdot b\\ \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 -1.704208961297091951604042405559569348925 \cdot 10^{59}:\\
\;\;\;\;\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\

\mathbf{elif}\;t \le 5.916611549783385719963359206108322041473 \cdot 10^{-6}:\\
\;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot t\right) \cdot z\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) + \left(a \cdot 27\right) \cdot b\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r634566 = x;
        double r634567 = 2.0;
        double r634568 = r634566 * r634567;
        double r634569 = y;
        double r634570 = 9.0;
        double r634571 = r634569 * r634570;
        double r634572 = z;
        double r634573 = r634571 * r634572;
        double r634574 = t;
        double r634575 = r634573 * r634574;
        double r634576 = r634568 - r634575;
        double r634577 = a;
        double r634578 = 27.0;
        double r634579 = r634577 * r634578;
        double r634580 = b;
        double r634581 = r634579 * r634580;
        double r634582 = r634576 + r634581;
        return r634582;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r634583 = t;
        double r634584 = -1.704208961297092e+59;
        bool r634585 = r634583 <= r634584;
        double r634586 = 2.0;
        double r634587 = x;
        double r634588 = r634586 * r634587;
        double r634589 = 27.0;
        double r634590 = a;
        double r634591 = b;
        double r634592 = r634590 * r634591;
        double r634593 = r634589 * r634592;
        double r634594 = r634588 + r634593;
        double r634595 = 9.0;
        double r634596 = z;
        double r634597 = y;
        double r634598 = r634596 * r634597;
        double r634599 = r634583 * r634598;
        double r634600 = r634595 * r634599;
        double r634601 = r634594 - r634600;
        double r634602 = 5.916611549783386e-06;
        bool r634603 = r634583 <= r634602;
        double r634604 = r634587 * r634586;
        double r634605 = r634595 * r634583;
        double r634606 = r634605 * r634596;
        double r634607 = r634597 * r634606;
        double r634608 = r634604 - r634607;
        double r634609 = r634590 * r634589;
        double r634610 = r634609 * r634591;
        double r634611 = r634608 + r634610;
        double r634612 = r634596 * r634595;
        double r634613 = r634597 * r634612;
        double r634614 = r634613 * r634583;
        double r634615 = r634604 - r634614;
        double r634616 = r634615 + r634610;
        double r634617 = r634603 ? r634611 : r634616;
        double r634618 = r634585 ? r634601 : r634617;
        return r634618;
}

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.7
Target2.6
Herbie0.7
\[\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 < -1.704208961297092e+59

    1. Initial program 0.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. Using strategy rm
    3. Applied associate-*l*9.2

      \[\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. Simplified9.2

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

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

    if -1.704208961297092e+59 < t < 5.916611549783386e-06

    1. Initial program 5.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.6

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

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

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

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

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

    if 5.916611549783386e-06 < t

    1. Initial program 0.9

      \[\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.9

      \[\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. Simplified0.9

      \[\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\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.704208961297091951604042405559569348925 \cdot 10^{59}:\\ \;\;\;\;\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\ \mathbf{elif}\;t \le 5.916611549783385719963359206108322041473 \cdot 10^{-6}:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(9 \cdot t\right) \cdot z\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) + \left(a \cdot 27\right) \cdot b\\ \end{array}\]

Reproduce

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