Average Error: 3.5 → 1.0
Time: 17.0s
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 -2.171737053366690492496454059018873464008 \cdot 10^{128} \lor \neg \left(t \le 7.801380694304143222876074466946704495704 \cdot 10^{45}\right):\\ \;\;\;\;27 \cdot \left(a \cdot b\right) + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(z \cdot 9\right) \cdot t\right)\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}\;t \le -2.171737053366690492496454059018873464008 \cdot 10^{128} \lor \neg \left(t \le 7.801380694304143222876074466946704495704 \cdot 10^{45}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - y \cdot \left(\left(z \cdot 9\right) \cdot t\right)\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 r590846 = x;
        double r590847 = 2.0;
        double r590848 = r590846 * r590847;
        double r590849 = y;
        double r590850 = 9.0;
        double r590851 = r590849 * r590850;
        double r590852 = z;
        double r590853 = r590851 * r590852;
        double r590854 = t;
        double r590855 = r590853 * r590854;
        double r590856 = r590848 - r590855;
        double r590857 = a;
        double r590858 = 27.0;
        double r590859 = r590857 * r590858;
        double r590860 = b;
        double r590861 = r590859 * r590860;
        double r590862 = r590856 + r590861;
        return r590862;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r590863 = t;
        double r590864 = -2.1717370533666905e+128;
        bool r590865 = r590863 <= r590864;
        double r590866 = 7.801380694304143e+45;
        bool r590867 = r590863 <= r590866;
        double r590868 = !r590867;
        bool r590869 = r590865 || r590868;
        double r590870 = 27.0;
        double r590871 = a;
        double r590872 = b;
        double r590873 = r590871 * r590872;
        double r590874 = r590870 * r590873;
        double r590875 = x;
        double r590876 = 2.0;
        double r590877 = r590875 * r590876;
        double r590878 = y;
        double r590879 = 9.0;
        double r590880 = r590878 * r590879;
        double r590881 = z;
        double r590882 = r590880 * r590881;
        double r590883 = r590882 * r590863;
        double r590884 = r590877 - r590883;
        double r590885 = r590874 + r590884;
        double r590886 = r590881 * r590879;
        double r590887 = r590886 * r590863;
        double r590888 = r590878 * r590887;
        double r590889 = r590877 - r590888;
        double r590890 = r590870 * r590872;
        double r590891 = r590871 * r590890;
        double r590892 = r590889 + r590891;
        double r590893 = r590869 ? r590885 : r590892;
        return r590893;
}

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.5
Target2.4
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 t < -2.1717370533666905e+128 or 7.801380694304143e+45 < t

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

      \[\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 pow10.9

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

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

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

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

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

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

    if -2.1717370533666905e+128 < t < 7.801380694304143e+45

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

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

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

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

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

Reproduce

herbie shell --seed 2019209 +o rules:numerics
(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)))