Average Error: 26.7 → 20.8
Time: 22.0s
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 -3.12495672458883210417207757793916938863 \cdot 10^{156}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -6.589405087646145397545694463395646896475 \cdot 10^{-131}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le -2.095166956824710074308713944918965338146 \cdot 10^{-265}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 2.208162098301683464952756427531284480568 \cdot 10^{-299}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 1.960478203321101005662703242780071695101 \cdot 10^{-101}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 7.362253523808575540220361610688922740015 \cdot 10^{167}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - y \cdot \frac{b}{\left(x + t\right) + y}\\ \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 -3.12495672458883210417207757793916938863 \cdot 10^{156}:\\
\;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\

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

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

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

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

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

\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 r145814736 = x;
        double r145814737 = y;
        double r145814738 = r145814736 + r145814737;
        double r145814739 = z;
        double r145814740 = r145814738 * r145814739;
        double r145814741 = t;
        double r145814742 = r145814741 + r145814737;
        double r145814743 = a;
        double r145814744 = r145814742 * r145814743;
        double r145814745 = r145814740 + r145814744;
        double r145814746 = b;
        double r145814747 = r145814737 * r145814746;
        double r145814748 = r145814745 - r145814747;
        double r145814749 = r145814736 + r145814741;
        double r145814750 = r145814749 + r145814737;
        double r145814751 = r145814748 / r145814750;
        return r145814751;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r145814752 = t;
        double r145814753 = -3.124956724588832e+156;
        bool r145814754 = r145814752 <= r145814753;
        double r145814755 = a;
        double r145814756 = y;
        double r145814757 = x;
        double r145814758 = r145814757 + r145814752;
        double r145814759 = r145814758 + r145814756;
        double r145814760 = b;
        double r145814761 = r145814759 / r145814760;
        double r145814762 = r145814756 / r145814761;
        double r145814763 = r145814755 - r145814762;
        double r145814764 = -6.589405087646145e-131;
        bool r145814765 = r145814752 <= r145814764;
        double r145814766 = 1.0;
        double r145814767 = r145814757 + r145814756;
        double r145814768 = z;
        double r145814769 = r145814767 * r145814768;
        double r145814770 = r145814752 + r145814756;
        double r145814771 = r145814770 * r145814755;
        double r145814772 = r145814769 + r145814771;
        double r145814773 = r145814759 / r145814772;
        double r145814774 = r145814766 / r145814773;
        double r145814775 = r145814760 / r145814759;
        double r145814776 = r145814756 * r145814775;
        double r145814777 = r145814774 - r145814776;
        double r145814778 = -2.09516695682471e-265;
        bool r145814779 = r145814752 <= r145814778;
        double r145814780 = r145814768 - r145814776;
        double r145814781 = 2.2081620983016835e-299;
        bool r145814782 = r145814752 <= r145814781;
        double r145814783 = 1.960478203321101e-101;
        bool r145814784 = r145814752 <= r145814783;
        double r145814785 = 7.362253523808576e+167;
        bool r145814786 = r145814752 <= r145814785;
        double r145814787 = r145814786 ? r145814777 : r145814763;
        double r145814788 = r145814784 ? r145814780 : r145814787;
        double r145814789 = r145814782 ? r145814777 : r145814788;
        double r145814790 = r145814779 ? r145814780 : r145814789;
        double r145814791 = r145814765 ? r145814777 : r145814790;
        double r145814792 = r145814754 ? r145814763 : r145814791;
        return r145814792;
}

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.7
Target11.5
Herbie20.8
\[\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.581311708415056427521064305370896655752 \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.228596430831560895857110658734089400289 \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 < -3.124956724588832e+156 or 7.362253523808576e+167 < t

    1. Initial program 37.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 div-sub37.9

      \[\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*35.1

      \[\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 19.9

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

    if -3.124956724588832e+156 < t < -6.589405087646145e-131 or -2.09516695682471e-265 < t < 2.2081620983016835e-299 or 1.960478203321101e-101 < t < 7.362253523808576e+167

    1. Initial program 23.8

      \[\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.8

      \[\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-identity23.8

      \[\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-frac21.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. Simplified21.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. Using strategy rm
    9. Applied clear-num21.3

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

    if -6.589405087646145e-131 < t < -2.09516695682471e-265 or 2.2081620983016835e-299 < t < 1.960478203321101e-101

    1. Initial program 22.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 div-sub22.3

      \[\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-identity22.3

      \[\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-frac21.3

      \[\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. Simplified21.3

      \[\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.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -3.12495672458883210417207757793916938863 \cdot 10^{156}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;t \le -6.589405087646145397545694463395646896475 \cdot 10^{-131}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le -2.095166956824710074308713944918965338146 \cdot 10^{-265}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 2.208162098301683464952756427531284480568 \cdot 10^{-299}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 1.960478203321101005662703242780071695101 \cdot 10^{-101}:\\ \;\;\;\;z - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;t \le 7.362253523808575540220361610688922740015 \cdot 10^{167}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}} - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019173 
(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.0 (/ (+ (+ 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)))