Average Error: 26.3 → 21.5
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}\;t \le -1.25150232717518858 \cdot 10^{200}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -4.1840463071979065 \cdot 10^{-131}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le 6.63565468032893206 \cdot 10^{-276}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 5.9747624034034444 \cdot 10^{-75}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le 2.51319291468979468 \cdot 10^{-6}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 3.53162670404046633 \cdot 10^{64}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{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}\;t \le -1.25150232717518858 \cdot 10^{200}:\\
\;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

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

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

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

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r1028823 = x;
        double r1028824 = y;
        double r1028825 = r1028823 + r1028824;
        double r1028826 = z;
        double r1028827 = r1028825 * r1028826;
        double r1028828 = t;
        double r1028829 = r1028828 + r1028824;
        double r1028830 = a;
        double r1028831 = r1028829 * r1028830;
        double r1028832 = r1028827 + r1028831;
        double r1028833 = b;
        double r1028834 = r1028824 * r1028833;
        double r1028835 = r1028832 - r1028834;
        double r1028836 = r1028823 + r1028828;
        double r1028837 = r1028836 + r1028824;
        double r1028838 = r1028835 / r1028837;
        return r1028838;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1028839 = t;
        double r1028840 = -1.2515023271751886e+200;
        bool r1028841 = r1028839 <= r1028840;
        double r1028842 = a;
        double r1028843 = y;
        double r1028844 = x;
        double r1028845 = r1028844 + r1028839;
        double r1028846 = r1028845 + r1028843;
        double r1028847 = b;
        double r1028848 = r1028846 / r1028847;
        double r1028849 = r1028843 / r1028848;
        double r1028850 = r1028842 - r1028849;
        double r1028851 = -4.1840463071979065e-131;
        bool r1028852 = r1028839 <= r1028851;
        double r1028853 = r1028844 + r1028843;
        double r1028854 = z;
        double r1028855 = r1028853 * r1028854;
        double r1028856 = r1028839 + r1028843;
        double r1028857 = r1028856 * r1028842;
        double r1028858 = r1028855 + r1028857;
        double r1028859 = r1028858 / r1028846;
        double r1028860 = r1028859 - r1028849;
        double r1028861 = 6.635654680328932e-276;
        bool r1028862 = r1028839 <= r1028861;
        double r1028863 = r1028847 / r1028846;
        double r1028864 = r1028843 * r1028863;
        double r1028865 = r1028854 - r1028864;
        double r1028866 = 5.974762403403444e-75;
        bool r1028867 = r1028839 <= r1028866;
        double r1028868 = 2.5131929146897947e-06;
        bool r1028869 = r1028839 <= r1028868;
        double r1028870 = 3.5316267040404663e+64;
        bool r1028871 = r1028839 <= r1028870;
        double r1028872 = r1028871 ? r1028860 : r1028850;
        double r1028873 = r1028869 ? r1028865 : r1028872;
        double r1028874 = r1028867 ? r1028860 : r1028873;
        double r1028875 = r1028862 ? r1028865 : r1028874;
        double r1028876 = r1028852 ? r1028860 : r1028875;
        double r1028877 = r1028841 ? r1028850 : r1028876;
        return r1028877;
}

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.3
Target11.3
Herbie21.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 3 regimes
  2. if t < -1.2515023271751886e+200 or 3.5316267040404663e+64 < t

    1. Initial program 34.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 div-sub34.6

      \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    4. Using strategy rm
    5. Applied associate-/l*32.0

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

      \[\leadsto \color{blue}{a} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\]

    if -1.2515023271751886e+200 < t < -4.1840463071979065e-131 or 6.635654680328932e-276 < t < 5.974762403403444e-75 or 2.5131929146897947e-06 < t < 3.5316267040404663e+64

    1. Initial program 23.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 div-sub23.7

      \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    4. Using strategy rm
    5. Applied associate-/l*21.9

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

    if -4.1840463071979065e-131 < t < 6.635654680328932e-276 or 5.974762403403444e-75 < t < 2.5131929146897947e-06

    1. Initial program 21.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 div-sub21.7

      \[\leadsto \color{blue}{\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity21.7

      \[\leadsto \frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y \cdot b}{\color{blue}{1 \cdot \left(\left(x + t\right) + y\right)}}\]
    6. Applied times-frac20.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.25150232717518858 \cdot 10^{200}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -4.1840463071979065 \cdot 10^{-131}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le 6.63565468032893206 \cdot 10^{-276}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 5.9747624034034444 \cdot 10^{-75}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le 2.51319291468979468 \cdot 10^{-6}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 3.53162670404046633 \cdot 10^{64}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \end{array}\]

Reproduce

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