Average Error: 3.7 → 0.8
Time: 4.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 -1.1081340794012077 \cdot 10^{60} \lor \neg \left(t \le 6.23600661209085351 \cdot 10^{-49}\right):\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot \left(9 \cdot z\right)\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\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}\;t \le -1.1081340794012077 \cdot 10^{60} \lor \neg \left(t \le 6.23600661209085351 \cdot 10^{-49}\right):\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot \left(9 \cdot z\right)\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\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 r764649 = x;
        double r764650 = 2.0;
        double r764651 = r764649 * r764650;
        double r764652 = y;
        double r764653 = 9.0;
        double r764654 = r764652 * r764653;
        double r764655 = z;
        double r764656 = r764654 * r764655;
        double r764657 = t;
        double r764658 = r764656 * r764657;
        double r764659 = r764651 - r764658;
        double r764660 = a;
        double r764661 = 27.0;
        double r764662 = r764660 * r764661;
        double r764663 = b;
        double r764664 = r764662 * r764663;
        double r764665 = r764659 + r764664;
        return r764665;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r764666 = t;
        double r764667 = -1.1081340794012077e+60;
        bool r764668 = r764666 <= r764667;
        double r764669 = 6.2360066120908535e-49;
        bool r764670 = r764666 <= r764669;
        double r764671 = !r764670;
        bool r764672 = r764668 || r764671;
        double r764673 = x;
        double r764674 = 2.0;
        double r764675 = r764673 * r764674;
        double r764676 = y;
        double r764677 = 9.0;
        double r764678 = z;
        double r764679 = r764677 * r764678;
        double r764680 = r764676 * r764679;
        double r764681 = r764680 * r764666;
        double r764682 = r764675 - r764681;
        double r764683 = a;
        double r764684 = 27.0;
        double r764685 = r764683 * r764684;
        double r764686 = b;
        double r764687 = r764685 * r764686;
        double r764688 = r764682 + r764687;
        double r764689 = r764678 * r764666;
        double r764690 = r764677 * r764689;
        double r764691 = r764676 * r764690;
        double r764692 = r764675 - r764691;
        double r764693 = r764683 * r764686;
        double r764694 = r764684 * r764693;
        double r764695 = r764692 + r764694;
        double r764696 = r764672 ? r764688 : r764695;
        return r764696;
}

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.9
Herbie0.8
\[\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 2 regimes
  2. if t < -1.1081340794012077e+60 or 6.2360066120908535e-49 < t

    1. Initial program 1.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*1.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\]

    if -1.1081340794012077e+60 < t < 6.2360066120908535e-49

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

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

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

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

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

Reproduce

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