Average Error: 25.4 → 13.7
Time: 18.2s
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 -7.316110015731767 \cdot 10^{-75}:\\ \;\;\;\;\left(a + z\right) - \left(\frac{1}{\left(y + t\right) + x} \cdot y\right) \cdot b\\ \mathbf{elif}\;y \le 8.638006545329685 \cdot 10^{+75}:\\ \;\;\;\;\frac{1}{\frac{\left(y + t\right) + x}{\left(y + t\right) \cdot a + \left(z \cdot \left(y + x\right) - y \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(a + z\right) - \left(\frac{1}{\left(y + t\right) + x} \cdot y\right) \cdot 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}\;y \le -7.316110015731767 \cdot 10^{-75}:\\
\;\;\;\;\left(a + z\right) - \left(\frac{1}{\left(y + t\right) + x} \cdot y\right) \cdot b\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r42782099 = x;
        double r42782100 = y;
        double r42782101 = r42782099 + r42782100;
        double r42782102 = z;
        double r42782103 = r42782101 * r42782102;
        double r42782104 = t;
        double r42782105 = r42782104 + r42782100;
        double r42782106 = a;
        double r42782107 = r42782105 * r42782106;
        double r42782108 = r42782103 + r42782107;
        double r42782109 = b;
        double r42782110 = r42782100 * r42782109;
        double r42782111 = r42782108 - r42782110;
        double r42782112 = r42782099 + r42782104;
        double r42782113 = r42782112 + r42782100;
        double r42782114 = r42782111 / r42782113;
        return r42782114;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r42782115 = y;
        double r42782116 = -7.316110015731767e-75;
        bool r42782117 = r42782115 <= r42782116;
        double r42782118 = a;
        double r42782119 = z;
        double r42782120 = r42782118 + r42782119;
        double r42782121 = 1.0;
        double r42782122 = t;
        double r42782123 = r42782115 + r42782122;
        double r42782124 = x;
        double r42782125 = r42782123 + r42782124;
        double r42782126 = r42782121 / r42782125;
        double r42782127 = r42782126 * r42782115;
        double r42782128 = b;
        double r42782129 = r42782127 * r42782128;
        double r42782130 = r42782120 - r42782129;
        double r42782131 = 8.638006545329685e+75;
        bool r42782132 = r42782115 <= r42782131;
        double r42782133 = r42782123 * r42782118;
        double r42782134 = r42782115 + r42782124;
        double r42782135 = r42782119 * r42782134;
        double r42782136 = r42782115 * r42782128;
        double r42782137 = r42782135 - r42782136;
        double r42782138 = r42782133 + r42782137;
        double r42782139 = r42782125 / r42782138;
        double r42782140 = r42782121 / r42782139;
        double r42782141 = r42782132 ? r42782140 : r42782130;
        double r42782142 = r42782117 ? r42782130 : r42782141;
        return r42782142;
}

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

Original25.4
Target11.2
Herbie13.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 < -7.316110015731767e-75 or 8.638006545329685e+75 < y

    1. Initial program 35.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. Simplified35.2

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

      \[\leadsto \frac{\color{blue}{\left(\left(y + t\right) \cdot a + z \cdot \left(x + y\right)\right) - b \cdot y}}{x + \left(y + t\right)}\]
    5. Applied div-sub35.2

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

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

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

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

      \[\leadsto \color{blue}{\left(a + z\right)} - b \cdot \frac{y}{x + \left(y + t\right)}\]
    11. Using strategy rm
    12. Applied div-inv11.9

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

    if -7.316110015731767e-75 < y < 8.638006545329685e+75

    1. Initial program 15.4

      \[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
    2. Simplified15.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -7.316110015731767 \cdot 10^{-75}:\\ \;\;\;\;\left(a + z\right) - \left(\frac{1}{\left(y + t\right) + x} \cdot y\right) \cdot b\\ \mathbf{elif}\;y \le 8.638006545329685 \cdot 10^{+75}:\\ \;\;\;\;\frac{1}{\frac{\left(y + t\right) + x}{\left(y + t\right) \cdot a + \left(z \cdot \left(y + x\right) - y \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(a + z\right) - \left(\frac{1}{\left(y + t\right) + x} \cdot y\right) \cdot b\\ \end{array}\]

Reproduce

herbie shell --seed 2019168 
(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 (/ (+ (+ 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)))