Average Error: 27.0 → 15.7
Time: 5.6s
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 -2.21374185212515322 \cdot 10^{39} \lor \neg \left(y \le 2.0040280940835718 \cdot 10^{61}\right):\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(\left(t + y\right) \cdot a - y \cdot b\right)}}\\ \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 -2.21374185212515322 \cdot 10^{39} \lor \neg \left(y \le 2.0040280940835718 \cdot 10^{61}\right):\\
\;\;\;\;\left(a + z\right) - b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r853678 = x;
        double r853679 = y;
        double r853680 = r853678 + r853679;
        double r853681 = z;
        double r853682 = r853680 * r853681;
        double r853683 = t;
        double r853684 = r853683 + r853679;
        double r853685 = a;
        double r853686 = r853684 * r853685;
        double r853687 = r853682 + r853686;
        double r853688 = b;
        double r853689 = r853679 * r853688;
        double r853690 = r853687 - r853689;
        double r853691 = r853678 + r853683;
        double r853692 = r853691 + r853679;
        double r853693 = r853690 / r853692;
        return r853693;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r853694 = y;
        double r853695 = -2.2137418521251532e+39;
        bool r853696 = r853694 <= r853695;
        double r853697 = 2.0040280940835718e+61;
        bool r853698 = r853694 <= r853697;
        double r853699 = !r853698;
        bool r853700 = r853696 || r853699;
        double r853701 = a;
        double r853702 = z;
        double r853703 = r853701 + r853702;
        double r853704 = b;
        double r853705 = r853703 - r853704;
        double r853706 = 1.0;
        double r853707 = x;
        double r853708 = t;
        double r853709 = r853707 + r853708;
        double r853710 = r853709 + r853694;
        double r853711 = r853707 + r853694;
        double r853712 = r853711 * r853702;
        double r853713 = r853708 + r853694;
        double r853714 = r853713 * r853701;
        double r853715 = r853694 * r853704;
        double r853716 = r853714 - r853715;
        double r853717 = r853712 + r853716;
        double r853718 = r853710 / r853717;
        double r853719 = r853706 / r853718;
        double r853720 = r853700 ? r853705 : r853719;
        return r853720;
}

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

Original27.0
Target11.4
Herbie15.7
\[\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 < -2.2137418521251532e+39 or 2.0040280940835718e+61 < y

    1. Initial program 42.3

      \[\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 associate--l+42.3

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

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

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

    if -2.2137418521251532e+39 < y < 2.0040280940835718e+61

    1. Initial program 15.9

      \[\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 associate--l+15.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.21374185212515322 \cdot 10^{39} \lor \neg \left(y \le 2.0040280940835718 \cdot 10^{61}\right):\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(\left(t + y\right) \cdot a - y \cdot b\right)}}\\ \end{array}\]

Reproduce

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