Average Error: 24.4 → 15.1
Time: 18.8s
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 -5.161631857410307 \cdot 10^{+87}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;y \le 1.2744164181753573 \cdot 10^{+42}:\\ \;\;\;\;\frac{a \cdot \left(y + t\right) + \left(\left(z - b\right) \cdot y + z \cdot x\right)}{x + \left(y + t\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(a + z\right) - 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 -5.161631857410307 \cdot 10^{+87}:\\
\;\;\;\;\left(a + z\right) - b\\

\mathbf{elif}\;y \le 1.2744164181753573 \cdot 10^{+42}:\\
\;\;\;\;\frac{a \cdot \left(y + t\right) + \left(\left(z - b\right) \cdot y + z \cdot x\right)}{x + \left(y + t\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r46889178 = x;
        double r46889179 = y;
        double r46889180 = r46889178 + r46889179;
        double r46889181 = z;
        double r46889182 = r46889180 * r46889181;
        double r46889183 = t;
        double r46889184 = r46889183 + r46889179;
        double r46889185 = a;
        double r46889186 = r46889184 * r46889185;
        double r46889187 = r46889182 + r46889186;
        double r46889188 = b;
        double r46889189 = r46889179 * r46889188;
        double r46889190 = r46889187 - r46889189;
        double r46889191 = r46889178 + r46889183;
        double r46889192 = r46889191 + r46889179;
        double r46889193 = r46889190 / r46889192;
        return r46889193;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r46889194 = y;
        double r46889195 = -5.161631857410307e+87;
        bool r46889196 = r46889194 <= r46889195;
        double r46889197 = a;
        double r46889198 = z;
        double r46889199 = r46889197 + r46889198;
        double r46889200 = b;
        double r46889201 = r46889199 - r46889200;
        double r46889202 = 1.2744164181753573e+42;
        bool r46889203 = r46889194 <= r46889202;
        double r46889204 = t;
        double r46889205 = r46889194 + r46889204;
        double r46889206 = r46889197 * r46889205;
        double r46889207 = r46889198 - r46889200;
        double r46889208 = r46889207 * r46889194;
        double r46889209 = x;
        double r46889210 = r46889198 * r46889209;
        double r46889211 = r46889208 + r46889210;
        double r46889212 = r46889206 + r46889211;
        double r46889213 = r46889209 + r46889205;
        double r46889214 = r46889212 / r46889213;
        double r46889215 = r46889203 ? r46889214 : r46889201;
        double r46889216 = r46889196 ? r46889201 : r46889215;
        return r46889216;
}

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

Original24.4
Target11.4
Herbie15.1
\[\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 < -5.161631857410307e+87 or 1.2744164181753573e+42 < y

    1. Initial program 39.4

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Simplified39.4

      \[\leadsto \color{blue}{\frac{\left(y + t\right) \cdot a + \left(z \cdot \left(x + y\right) - b \cdot y\right)}{x + \left(y + t\right)}}\]
    3. Taylor expanded around inf 15.1

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

    if -5.161631857410307e+87 < y < 1.2744164181753573e+42

    1. Initial program 15.0

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Simplified15.0

      \[\leadsto \color{blue}{\frac{\left(y + t\right) \cdot a + \left(z \cdot \left(x + y\right) - b \cdot y\right)}{x + \left(y + t\right)}}\]
    3. Using strategy rm
    4. Applied distribute-rgt-in15.0

      \[\leadsto \frac{\left(y + t\right) \cdot a + \left(\color{blue}{\left(x \cdot z + y \cdot z\right)} - b \cdot y\right)}{x + \left(y + t\right)}\]
    5. Applied associate--l+15.0

      \[\leadsto \frac{\left(y + t\right) \cdot a + \color{blue}{\left(x \cdot z + \left(y \cdot z - b \cdot y\right)\right)}}{x + \left(y + t\right)}\]
    6. Simplified15.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -5.161631857410307 \cdot 10^{+87}:\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{elif}\;y \le 1.2744164181753573 \cdot 10^{+42}:\\ \;\;\;\;\frac{a \cdot \left(y + t\right) + \left(\left(z - b\right) \cdot y + z \cdot x\right)}{x + \left(y + t\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(a + z\right) - b\\ \end{array}\]

Reproduce

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

  :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)))