Average Error: 3.5 → 0.9
Time: 13.2s
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 -6.660311807137084788107015105621119988366 \cdot 10^{90} \lor \neg \left(t \le 6.858672798378862507206508113638693409984 \cdot 10^{53}\right):\\ \;\;\;\;27 \cdot \left(a \cdot b\right) + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \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 -6.660311807137084788107015105621119988366 \cdot 10^{90} \lor \neg \left(t \le 6.858672798378862507206508113638693409984 \cdot 10^{53}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r529648 = x;
        double r529649 = 2.0;
        double r529650 = r529648 * r529649;
        double r529651 = y;
        double r529652 = 9.0;
        double r529653 = r529651 * r529652;
        double r529654 = z;
        double r529655 = r529653 * r529654;
        double r529656 = t;
        double r529657 = r529655 * r529656;
        double r529658 = r529650 - r529657;
        double r529659 = a;
        double r529660 = 27.0;
        double r529661 = r529659 * r529660;
        double r529662 = b;
        double r529663 = r529661 * r529662;
        double r529664 = r529658 + r529663;
        return r529664;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r529665 = t;
        double r529666 = -6.660311807137085e+90;
        bool r529667 = r529665 <= r529666;
        double r529668 = 6.8586727983788625e+53;
        bool r529669 = r529665 <= r529668;
        double r529670 = !r529669;
        bool r529671 = r529667 || r529670;
        double r529672 = 27.0;
        double r529673 = a;
        double r529674 = b;
        double r529675 = r529673 * r529674;
        double r529676 = r529672 * r529675;
        double r529677 = x;
        double r529678 = 2.0;
        double r529679 = r529677 * r529678;
        double r529680 = y;
        double r529681 = 9.0;
        double r529682 = r529680 * r529681;
        double r529683 = z;
        double r529684 = r529682 * r529683;
        double r529685 = r529684 * r529665;
        double r529686 = r529679 - r529685;
        double r529687 = r529676 + r529686;
        double r529688 = r529683 * r529665;
        double r529689 = r529682 * r529688;
        double r529690 = r529679 - r529689;
        double r529691 = r529672 * r529674;
        double r529692 = r529673 * r529691;
        double r529693 = r529690 + r529692;
        double r529694 = r529671 ? r529687 : r529693;
        return r529694;
}

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
Herbie0.9
\[\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 2 regimes
  2. if t < -6.660311807137085e+90 or 6.8586727983788625e+53 < t

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

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

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

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

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

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

      \[\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}\]

    if -6.660311807137085e+90 < t < 6.8586727983788625e+53

    1. Initial program 4.7

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

      \[\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)}\]
    4. Using strategy rm
    5. Applied associate-*l*1.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -6.660311807137084788107015105621119988366 \cdot 10^{90} \lor \neg \left(t \le 6.858672798378862507206508113638693409984 \cdot 10^{53}\right):\\ \;\;\;\;27 \cdot \left(a \cdot b\right) + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\ \end{array}\]

Reproduce

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