Average Error: 27.0 → 20.0
Time: 7.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 -1.6180785068215594 \cdot 10^{233}:\\ \;\;\;\;a - \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\right)\\ \mathbf{elif}\;y \le -2.54381506746759348 \cdot 10^{164}:\\ \;\;\;\;z - \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\right)\\ \mathbf{elif}\;y \le -1.80738930203575709 \cdot 10^{81}:\\ \;\;\;\;a - \frac{y}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\\ \mathbf{elif}\;y \le 9.18430122690207579 \cdot 10^{57}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1} \cdot \frac{1}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;z - \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\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 -1.6180785068215594 \cdot 10^{233}:\\
\;\;\;\;a - \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\right)\\

\mathbf{elif}\;y \le -2.54381506746759348 \cdot 10^{164}:\\
\;\;\;\;z - \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\right)\\

\mathbf{elif}\;y \le -1.80738930203575709 \cdot 10^{81}:\\
\;\;\;\;a - \frac{y}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\\

\mathbf{elif}\;y \le 9.18430122690207579 \cdot 10^{57}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1} \cdot \frac{1}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r804064 = x;
        double r804065 = y;
        double r804066 = r804064 + r804065;
        double r804067 = z;
        double r804068 = r804066 * r804067;
        double r804069 = t;
        double r804070 = r804069 + r804065;
        double r804071 = a;
        double r804072 = r804070 * r804071;
        double r804073 = r804068 + r804072;
        double r804074 = b;
        double r804075 = r804065 * r804074;
        double r804076 = r804073 - r804075;
        double r804077 = r804064 + r804069;
        double r804078 = r804077 + r804065;
        double r804079 = r804076 / r804078;
        return r804079;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r804080 = y;
        double r804081 = -1.6180785068215594e+233;
        bool r804082 = r804080 <= r804081;
        double r804083 = a;
        double r804084 = cbrt(r804080);
        double r804085 = r804084 * r804084;
        double r804086 = x;
        double r804087 = t;
        double r804088 = r804086 + r804087;
        double r804089 = r804088 + r804080;
        double r804090 = cbrt(r804089);
        double r804091 = r804085 / r804090;
        double r804092 = r804084 / r804090;
        double r804093 = b;
        double r804094 = r804093 / r804090;
        double r804095 = r804092 * r804094;
        double r804096 = r804091 * r804095;
        double r804097 = r804083 - r804096;
        double r804098 = -2.5438150674675935e+164;
        bool r804099 = r804080 <= r804098;
        double r804100 = z;
        double r804101 = r804100 - r804096;
        double r804102 = -1.807389302035757e+81;
        bool r804103 = r804080 <= r804102;
        double r804104 = r804090 * r804090;
        double r804105 = r804080 / r804104;
        double r804106 = r804105 * r804094;
        double r804107 = r804083 - r804106;
        double r804108 = 9.184301226902076e+57;
        bool r804109 = r804080 <= r804108;
        double r804110 = r804086 + r804080;
        double r804111 = r804087 + r804080;
        double r804112 = r804111 * r804083;
        double r804113 = fma(r804110, r804100, r804112);
        double r804114 = 1.0;
        double r804115 = r804113 / r804114;
        double r804116 = r804114 / r804089;
        double r804117 = r804115 * r804116;
        double r804118 = r804080 * r804093;
        double r804119 = r804118 / r804089;
        double r804120 = r804117 - r804119;
        double r804121 = r804109 ? r804120 : r804101;
        double r804122 = r804103 ? r804107 : r804121;
        double r804123 = r804099 ? r804101 : r804122;
        double r804124 = r804082 ? r804097 : r804123;
        return r804124;
}

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

Target

Original27.0
Target11.7
Herbie20.0
\[\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 4 regimes
  2. if y < -1.6180785068215594e+233

    1. Initial program 52.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-sub52.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. Simplified52.7

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt52.7

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{y \cdot b}{\color{blue}{\left(\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}\right) \cdot \sqrt[3]{\left(x + t\right) + y}}}\]
    7. Applied times-frac42.4

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt42.3

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\]
    10. Applied times-frac42.3

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}}\right)} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\]
    11. Applied associate-*l*42.3

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\right)}\]
    12. Taylor expanded around 0 22.9

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

    if -1.6180785068215594e+233 < y < -2.5438150674675935e+164 or 9.184301226902076e+57 < y

    1. Initial program 42.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-sub42.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. Simplified42.9

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt43.0

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{y \cdot b}{\color{blue}{\left(\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}\right) \cdot \sqrt[3]{\left(x + t\right) + y}}}\]
    7. Applied times-frac34.5

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt34.4

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\]
    10. Applied times-frac34.4

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}}\right)} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\]
    11. Applied associate-*l*34.4

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\right)}\]
    12. Taylor expanded around inf 25.8

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

    if -2.5438150674675935e+164 < y < -1.807389302035757e+81

    1. Initial program 34.5

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

      \[\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. Simplified34.5

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt34.7

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \frac{y \cdot b}{\color{blue}{\left(\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}\right) \cdot \sqrt[3]{\left(x + t\right) + y}}}\]
    7. Applied times-frac26.5

      \[\leadsto \frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y} - \color{blue}{\frac{y}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}}\]
    8. Taylor expanded around 0 25.0

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

    if -1.807389302035757e+81 < y < 9.184301226902076e+57

    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 div-sub16.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. Simplified16.7

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1}}{\left(x + t\right) + y}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Using strategy rm
    6. Applied div-inv16.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.6180785068215594 \cdot 10^{233}:\\ \;\;\;\;a - \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\right)\\ \mathbf{elif}\;y \le -2.54381506746759348 \cdot 10^{164}:\\ \;\;\;\;z - \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\right)\\ \mathbf{elif}\;y \le -1.80738930203575709 \cdot 10^{81}:\\ \;\;\;\;a - \frac{y}{\sqrt[3]{\left(x + t\right) + y} \cdot \sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\\ \mathbf{elif}\;y \le 9.18430122690207579 \cdot 10^{57}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x + y, z, \left(t + y\right) \cdot a\right)}{1} \cdot \frac{1}{\left(x + t\right) + y} - \frac{y \cdot b}{\left(x + t\right) + y}\\ \mathbf{else}:\\ \;\;\;\;z - \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \left(\frac{\sqrt[3]{y}}{\sqrt[3]{\left(x + t\right) + y}} \cdot \frac{b}{\sqrt[3]{\left(x + t\right) + y}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020033 +o rules:numerics
(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)))