Average Error: 3.7 → 0.8
Time: 17.1s
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 -21855168504066649061551236802221703168 \lor \neg \left(t \le 1.840953993222679912181481980388341104947 \cdot 10^{56}\right):\\ \;\;\;\;x \cdot 2 + \left(27 \cdot \left(a \cdot b\right) - \left(9 \cdot t\right) \cdot \left(z \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 2 + \left(27 \cdot \left(a \cdot b\right) - \left(\left(9 \cdot t\right) \cdot z\right) \cdot y\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 -21855168504066649061551236802221703168 \lor \neg \left(t \le 1.840953993222679912181481980388341104947 \cdot 10^{56}\right):\\
\;\;\;\;x \cdot 2 + \left(27 \cdot \left(a \cdot b\right) - \left(9 \cdot t\right) \cdot \left(z \cdot y\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r511069 = x;
        double r511070 = 2.0;
        double r511071 = r511069 * r511070;
        double r511072 = y;
        double r511073 = 9.0;
        double r511074 = r511072 * r511073;
        double r511075 = z;
        double r511076 = r511074 * r511075;
        double r511077 = t;
        double r511078 = r511076 * r511077;
        double r511079 = r511071 - r511078;
        double r511080 = a;
        double r511081 = 27.0;
        double r511082 = r511080 * r511081;
        double r511083 = b;
        double r511084 = r511082 * r511083;
        double r511085 = r511079 + r511084;
        return r511085;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r511086 = t;
        double r511087 = -2.185516850406665e+37;
        bool r511088 = r511086 <= r511087;
        double r511089 = 1.84095399322268e+56;
        bool r511090 = r511086 <= r511089;
        double r511091 = !r511090;
        bool r511092 = r511088 || r511091;
        double r511093 = x;
        double r511094 = 2.0;
        double r511095 = r511093 * r511094;
        double r511096 = 27.0;
        double r511097 = a;
        double r511098 = b;
        double r511099 = r511097 * r511098;
        double r511100 = r511096 * r511099;
        double r511101 = 9.0;
        double r511102 = r511101 * r511086;
        double r511103 = z;
        double r511104 = y;
        double r511105 = r511103 * r511104;
        double r511106 = r511102 * r511105;
        double r511107 = r511100 - r511106;
        double r511108 = r511095 + r511107;
        double r511109 = r511102 * r511103;
        double r511110 = r511109 * r511104;
        double r511111 = r511100 - r511110;
        double r511112 = r511095 + r511111;
        double r511113 = r511092 ? r511108 : r511112;
        return r511113;
}

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.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 < -2.185516850406665e+37 or 1.84095399322268e+56 < 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 sub-neg0.8

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

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

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

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

    if -2.185516850406665e+37 < t < 1.84095399322268e+56

    1. Initial program 5.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 sub-neg5.2

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

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

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

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

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

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

Reproduce

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