Average Error: 27.2 → 17.3
Time: 17.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.355585068593240611312869652125605328595 \cdot 10^{-45} \lor \neg \left(y \le 7.974061462163527509529741971981870705504 \cdot 10^{98}\right):\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t + y, \mathsf{fma}\left(x, z, \left(y \cdot \left(\sqrt[3]{z - b} \cdot \sqrt[3]{z - b}\right)\right) \cdot \sqrt[3]{z - b}\right)\right) \cdot \frac{1}{\left(x + t\right) + y}\\ \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.355585068593240611312869652125605328595 \cdot 10^{-45} \lor \neg \left(y \le 7.974061462163527509529741971981870705504 \cdot 10^{98}\right):\\
\;\;\;\;\left(a + z\right) - b\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r620169 = x;
        double r620170 = y;
        double r620171 = r620169 + r620170;
        double r620172 = z;
        double r620173 = r620171 * r620172;
        double r620174 = t;
        double r620175 = r620174 + r620170;
        double r620176 = a;
        double r620177 = r620175 * r620176;
        double r620178 = r620173 + r620177;
        double r620179 = b;
        double r620180 = r620170 * r620179;
        double r620181 = r620178 - r620180;
        double r620182 = r620169 + r620174;
        double r620183 = r620182 + r620170;
        double r620184 = r620181 / r620183;
        return r620184;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r620185 = y;
        double r620186 = -1.3555850685932406e-45;
        bool r620187 = r620185 <= r620186;
        double r620188 = 7.974061462163528e+98;
        bool r620189 = r620185 <= r620188;
        double r620190 = !r620189;
        bool r620191 = r620187 || r620190;
        double r620192 = a;
        double r620193 = z;
        double r620194 = r620192 + r620193;
        double r620195 = b;
        double r620196 = r620194 - r620195;
        double r620197 = t;
        double r620198 = r620197 + r620185;
        double r620199 = x;
        double r620200 = r620193 - r620195;
        double r620201 = cbrt(r620200);
        double r620202 = r620201 * r620201;
        double r620203 = r620185 * r620202;
        double r620204 = r620203 * r620201;
        double r620205 = fma(r620199, r620193, r620204);
        double r620206 = fma(r620192, r620198, r620205);
        double r620207 = 1.0;
        double r620208 = r620199 + r620197;
        double r620209 = r620208 + r620185;
        double r620210 = r620207 / r620209;
        double r620211 = r620206 * r620210;
        double r620212 = r620191 ? r620196 : r620211;
        return r620212;
}

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.2
Target11.2
Herbie17.3
\[\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 2 regimes
  2. if y < -1.3555850685932406e-45 or 7.974061462163528e+98 < y

    1. Initial program 39.2

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

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

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

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

    if -1.3555850685932406e-45 < y < 7.974061462163528e+98

    1. Initial program 16.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. Simplified16.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.355585068593240611312869652125605328595 \cdot 10^{-45} \lor \neg \left(y \le 7.974061462163527509529741971981870705504 \cdot 10^{98}\right):\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(a, t + y, \mathsf{fma}\left(x, z, \left(y \cdot \left(\sqrt[3]{z - b} \cdot \sqrt[3]{z - b}\right)\right) \cdot \sqrt[3]{z - b}\right)\right) \cdot \frac{1}{\left(x + t\right) + y}\\ \end{array}\]

Reproduce

herbie shell --seed 2019326 +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)))