Average Error: 3.6 → 1.0
Time: 16.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}\;\left(\left(y \cdot 9\right) \cdot z\right) \cdot t = -\infty \lor \neg \left(\left(\left(y \cdot 9\right) \cdot z\right) \cdot t \le 1.659231677665064540477277111084746690511 \cdot 10^{250}\right):\\ \;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(t \cdot z\right) \cdot \left(9 \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\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}\;\left(\left(y \cdot 9\right) \cdot z\right) \cdot t = -\infty \lor \neg \left(\left(\left(y \cdot 9\right) \cdot z\right) \cdot t \le 1.659231677665064540477277111084746690511 \cdot 10^{250}\right):\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(t \cdot z\right) \cdot \left(9 \cdot y\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\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 r498898 = x;
        double r498899 = 2.0;
        double r498900 = r498898 * r498899;
        double r498901 = y;
        double r498902 = 9.0;
        double r498903 = r498901 * r498902;
        double r498904 = z;
        double r498905 = r498903 * r498904;
        double r498906 = t;
        double r498907 = r498905 * r498906;
        double r498908 = r498900 - r498907;
        double r498909 = a;
        double r498910 = 27.0;
        double r498911 = r498909 * r498910;
        double r498912 = b;
        double r498913 = r498911 * r498912;
        double r498914 = r498908 + r498913;
        return r498914;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r498915 = y;
        double r498916 = 9.0;
        double r498917 = r498915 * r498916;
        double r498918 = z;
        double r498919 = r498917 * r498918;
        double r498920 = t;
        double r498921 = r498919 * r498920;
        double r498922 = -inf.0;
        bool r498923 = r498921 <= r498922;
        double r498924 = 1.6592316776650645e+250;
        bool r498925 = r498921 <= r498924;
        double r498926 = !r498925;
        bool r498927 = r498923 || r498926;
        double r498928 = a;
        double r498929 = 27.0;
        double r498930 = r498928 * r498929;
        double r498931 = b;
        double r498932 = r498930 * r498931;
        double r498933 = x;
        double r498934 = 2.0;
        double r498935 = r498933 * r498934;
        double r498936 = r498920 * r498918;
        double r498937 = r498916 * r498915;
        double r498938 = r498936 * r498937;
        double r498939 = r498935 - r498938;
        double r498940 = r498932 + r498939;
        double r498941 = r498935 - r498921;
        double r498942 = r498929 * r498931;
        double r498943 = r498928 * r498942;
        double r498944 = r498941 + r498943;
        double r498945 = r498927 ? r498940 : r498944;
        return r498945;
}

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.8
Herbie1.0
\[\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) z) t) < -inf.0 or 1.6592316776650645e+250 < (* (* (* y 9.0) z) t)

    1. Initial program 40.5

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

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

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

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

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

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

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

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

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

    if -inf.0 < (* (* (* y 9.0) z) t) < 1.6592316776650645e+250

    1. Initial program 0.5

      \[\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)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.0

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

Reproduce

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