Average Error: 3.8 → 1.4
Time: 3.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 -1.4345514448623531 \cdot 10^{141} \lor \neg \left(t \le 1.3766689574579702 \cdot 10^{-150}\right):\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot \left(9 \cdot z\right)\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot x - 9 \cdot \left(\left(t \cdot z\right) \cdot y\right)\right) + {\left(27 \cdot \left(a \cdot b\right)\right)}^{1}\\ \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.4345514448623531 \cdot 10^{141} \lor \neg \left(t \le 1.3766689574579702 \cdot 10^{-150}\right):\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot \left(9 \cdot z\right)\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r770727 = x;
        double r770728 = 2.0;
        double r770729 = r770727 * r770728;
        double r770730 = y;
        double r770731 = 9.0;
        double r770732 = r770730 * r770731;
        double r770733 = z;
        double r770734 = r770732 * r770733;
        double r770735 = t;
        double r770736 = r770734 * r770735;
        double r770737 = r770729 - r770736;
        double r770738 = a;
        double r770739 = 27.0;
        double r770740 = r770738 * r770739;
        double r770741 = b;
        double r770742 = r770740 * r770741;
        double r770743 = r770737 + r770742;
        return r770743;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r770744 = t;
        double r770745 = -1.4345514448623531e+141;
        bool r770746 = r770744 <= r770745;
        double r770747 = 1.3766689574579702e-150;
        bool r770748 = r770744 <= r770747;
        double r770749 = !r770748;
        bool r770750 = r770746 || r770749;
        double r770751 = x;
        double r770752 = 2.0;
        double r770753 = r770751 * r770752;
        double r770754 = y;
        double r770755 = 9.0;
        double r770756 = z;
        double r770757 = r770755 * r770756;
        double r770758 = r770754 * r770757;
        double r770759 = r770758 * r770744;
        double r770760 = r770753 - r770759;
        double r770761 = a;
        double r770762 = 27.0;
        double r770763 = b;
        double r770764 = r770762 * r770763;
        double r770765 = r770761 * r770764;
        double r770766 = r770760 + r770765;
        double r770767 = r770752 * r770751;
        double r770768 = r770744 * r770756;
        double r770769 = r770768 * r770754;
        double r770770 = r770755 * r770769;
        double r770771 = r770767 - r770770;
        double r770772 = r770761 * r770763;
        double r770773 = r770762 * r770772;
        double r770774 = 1.0;
        double r770775 = pow(r770773, r770774);
        double r770776 = r770771 + r770775;
        double r770777 = r770750 ? r770766 : r770776;
        return r770777;
}

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.8
Target2.7
Herbie1.4
\[\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.4345514448623531e+141 or 1.3766689574579702e-150 < t

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

      \[\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. Using strategy rm
    5. Applied associate-*l*1.8

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

    if -1.4345514448623531e+141 < t < 1.3766689574579702e-150

    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*5.5

      \[\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. Using strategy rm
    5. Applied pow15.5

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

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

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

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

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

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

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

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

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

Reproduce

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