Average Error: 3.6 → 0.8
Time: 13.4s
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}\;y \cdot 9 \le -316632020739315302665499443200 \lor \neg \left(y \cdot 9 \le 1.656597507920291123155500369549806061406 \cdot 10^{-81}\right):\\ \;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(t \cdot z\right)\right) + \left(a \cdot 27\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right) - \sqrt{9} \cdot \left(\sqrt{9} \cdot \left(t \cdot \left(z \cdot y\right)\right)\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}\;y \cdot 9 \le -316632020739315302665499443200 \lor \neg \left(y \cdot 9 \le 1.656597507920291123155500369549806061406 \cdot 10^{-81}\right):\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(t \cdot z\right)\right) + \left(a \cdot 27\right) \cdot b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r51825 = x;
        double r51826 = 2.0;
        double r51827 = r51825 * r51826;
        double r51828 = y;
        double r51829 = 9.0;
        double r51830 = r51828 * r51829;
        double r51831 = z;
        double r51832 = r51830 * r51831;
        double r51833 = t;
        double r51834 = r51832 * r51833;
        double r51835 = r51827 - r51834;
        double r51836 = a;
        double r51837 = 27.0;
        double r51838 = r51836 * r51837;
        double r51839 = b;
        double r51840 = r51838 * r51839;
        double r51841 = r51835 + r51840;
        return r51841;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r51842 = y;
        double r51843 = 9.0;
        double r51844 = r51842 * r51843;
        double r51845 = -3.166320207393153e+29;
        bool r51846 = r51844 <= r51845;
        double r51847 = 1.6565975079202911e-81;
        bool r51848 = r51844 <= r51847;
        double r51849 = !r51848;
        bool r51850 = r51846 || r51849;
        double r51851 = x;
        double r51852 = 2.0;
        double r51853 = r51851 * r51852;
        double r51854 = t;
        double r51855 = z;
        double r51856 = r51854 * r51855;
        double r51857 = r51844 * r51856;
        double r51858 = r51853 - r51857;
        double r51859 = a;
        double r51860 = 27.0;
        double r51861 = r51859 * r51860;
        double r51862 = b;
        double r51863 = r51861 * r51862;
        double r51864 = r51858 + r51863;
        double r51865 = r51852 * r51851;
        double r51866 = r51859 * r51862;
        double r51867 = r51860 * r51866;
        double r51868 = r51865 + r51867;
        double r51869 = sqrt(r51843);
        double r51870 = r51855 * r51842;
        double r51871 = r51854 * r51870;
        double r51872 = r51869 * r51871;
        double r51873 = r51869 * r51872;
        double r51874 = r51868 - r51873;
        double r51875 = r51850 ? r51864 : r51874;
        return r51875;
}

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.6
Target2.6
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 (* y 9.0) < -3.166320207393153e+29 or 1.6565975079202911e-81 < (* y 9.0)

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

      \[\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. Simplified1.1

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

    if -3.166320207393153e+29 < (* y 9.0) < 1.6565975079202911e-81

    1. Initial program 0.6

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

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

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

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

      \[\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)}\]
    8. Using strategy rm
    9. Applied add-sqr-sqrt0.5

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

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

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

Reproduce

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