Average Error: 26.9 → 15.5
Time: 7.4s
Precision: 64
\[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.2530472374427502 \cdot 10^{96} \lor \neg \left(y \le 2.17730850491353258 \cdot 10^{64}\right):\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{1}}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\\ \end{array}\]
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\begin{array}{l}
\mathbf{if}\;y \le -4.2530472374427502 \cdot 10^{96} \lor \neg \left(y \le 2.17730850491353258 \cdot 10^{64}\right):\\
\;\;\;\;\left(a + z\right) - b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r889082 = x;
        double r889083 = y;
        double r889084 = r889082 + r889083;
        double r889085 = z;
        double r889086 = r889084 * r889085;
        double r889087 = t;
        double r889088 = r889087 + r889083;
        double r889089 = a;
        double r889090 = r889088 * r889089;
        double r889091 = r889086 + r889090;
        double r889092 = b;
        double r889093 = r889083 * r889092;
        double r889094 = r889091 - r889093;
        double r889095 = r889082 + r889087;
        double r889096 = r889095 + r889083;
        double r889097 = r889094 / r889096;
        return r889097;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r889098 = y;
        double r889099 = -4.25304723744275e+96;
        bool r889100 = r889098 <= r889099;
        double r889101 = 2.1773085049135326e+64;
        bool r889102 = r889098 <= r889101;
        double r889103 = !r889102;
        bool r889104 = r889100 || r889103;
        double r889105 = a;
        double r889106 = z;
        double r889107 = r889105 + r889106;
        double r889108 = b;
        double r889109 = r889107 - r889108;
        double r889110 = 1.0;
        double r889111 = sqrt(r889110);
        double r889112 = x;
        double r889113 = t;
        double r889114 = r889112 + r889113;
        double r889115 = r889114 + r889098;
        double r889116 = r889112 + r889098;
        double r889117 = r889116 * r889106;
        double r889118 = r889113 + r889098;
        double r889119 = r889118 * r889105;
        double r889120 = r889117 + r889119;
        double r889121 = r889098 * r889108;
        double r889122 = r889120 - r889121;
        double r889123 = r889115 / r889122;
        double r889124 = r889111 / r889123;
        double r889125 = r889104 ? r889109 : r889124;
        return r889125;
}

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

Original26.9
Target10.8
Herbie15.5
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \lt -3.5813117084150564 \cdot 10^{153}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \lt 1.2285964308315609 \cdot 10^{82}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -4.25304723744275e+96 or 2.1773085049135326e+64 < y

    1. Initial program 44.6

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Using strategy rm
    3. Applied clear-num44.6

      \[\leadsto \color{blue}{\frac{1}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}}\]
    4. Taylor expanded around 0 13.2

      \[\leadsto \color{blue}{\left(a + z\right) - b}\]

    if -4.25304723744275e+96 < y < 2.1773085049135326e+64

    1. Initial program 16.7

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Using strategy rm
    3. Applied clear-num16.8

      \[\leadsto \color{blue}{\frac{1}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt16.8

      \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\]
    6. Applied associate-/l*16.8

      \[\leadsto \color{blue}{\frac{\sqrt{1}}{\frac{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}{\sqrt{1}}}}\]
    7. Simplified16.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -4.2530472374427502 \cdot 10^{96} \lor \neg \left(y \le 2.17730850491353258 \cdot 10^{64}\right):\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{1}}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020020 
(FPCore (x y z t a b)
  :name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
  :precision binary64

  :herbie-target
  (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3.5813117084150564e+153) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 1.2285964308315609e+82) (/ 1 (/ (+ (+ x t) y) (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))) (- (+ z a) b)))

  (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))