Average Error: 26.4 → 20.4
Time: 15.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}\;a \le -1.06965165566976033823472063755939570788 \cdot 10^{105}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;a \le -6.647028763193771608577656210051197189253 \cdot 10^{79}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;a \le -5.908454188501267002593291613176370164849 \cdot 10^{54}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;a \le -1365037.00766297127120196819305419921875:\\ \;\;\;\;\left(\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\right) \cdot \frac{1}{\left(x + t\right) + y}\\ \mathbf{elif}\;a \le -1.895421502612701232401673873582106236223 \cdot 10^{-14}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;a \le 1.380901554845331477817825572366401542513 \cdot 10^{-200}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 1.084345973411002110707221228148213091302 \cdot 10^{-132}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;a \le 2.162608224808070531691010276609765583335 \cdot 10^{61}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{else}:\\ \;\;\;\;a - y \cdot \frac{b}{\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}\;a \le -1.06965165566976033823472063755939570788 \cdot 10^{105}:\\
\;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\

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

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

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

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

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

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r729271 = x;
        double r729272 = y;
        double r729273 = r729271 + r729272;
        double r729274 = z;
        double r729275 = r729273 * r729274;
        double r729276 = t;
        double r729277 = r729276 + r729272;
        double r729278 = a;
        double r729279 = r729277 * r729278;
        double r729280 = r729275 + r729279;
        double r729281 = b;
        double r729282 = r729272 * r729281;
        double r729283 = r729280 - r729282;
        double r729284 = r729271 + r729276;
        double r729285 = r729284 + r729272;
        double r729286 = r729283 / r729285;
        return r729286;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r729287 = a;
        double r729288 = -1.0696516556697603e+105;
        bool r729289 = r729287 <= r729288;
        double r729290 = y;
        double r729291 = b;
        double r729292 = x;
        double r729293 = t;
        double r729294 = r729292 + r729293;
        double r729295 = r729294 + r729290;
        double r729296 = r729291 / r729295;
        double r729297 = r729290 * r729296;
        double r729298 = r729287 - r729297;
        double r729299 = -6.647028763193772e+79;
        bool r729300 = r729287 <= r729299;
        double r729301 = z;
        double r729302 = r729295 / r729291;
        double r729303 = r729290 / r729302;
        double r729304 = r729301 - r729303;
        double r729305 = -5.908454188501267e+54;
        bool r729306 = r729287 <= r729305;
        double r729307 = -1365037.0076629713;
        bool r729308 = r729287 <= r729307;
        double r729309 = r729292 + r729290;
        double r729310 = r729309 * r729301;
        double r729311 = r729293 + r729290;
        double r729312 = r729311 * r729287;
        double r729313 = r729310 + r729312;
        double r729314 = r729290 * r729291;
        double r729315 = r729313 - r729314;
        double r729316 = 1.0;
        double r729317 = r729316 / r729295;
        double r729318 = r729315 * r729317;
        double r729319 = -1.8954215026127012e-14;
        bool r729320 = r729287 <= r729319;
        double r729321 = 1.3809015548453315e-200;
        bool r729322 = r729287 <= r729321;
        double r729323 = r729313 / r729295;
        double r729324 = r729290 / r729295;
        double r729325 = r729324 * r729291;
        double r729326 = r729323 - r729325;
        double r729327 = 1.0843459734110021e-132;
        bool r729328 = r729287 <= r729327;
        double r729329 = 2.1626082248080705e+61;
        bool r729330 = r729287 <= r729329;
        double r729331 = r729330 ? r729326 : r729298;
        double r729332 = r729328 ? r729304 : r729331;
        double r729333 = r729322 ? r729326 : r729332;
        double r729334 = r729320 ? r729304 : r729333;
        double r729335 = r729308 ? r729318 : r729334;
        double r729336 = r729306 ? r729298 : r729335;
        double r729337 = r729300 ? r729304 : r729336;
        double r729338 = r729289 ? r729298 : r729337;
        return r729338;
}

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.4
Target11.1
Herbie20.4
\[\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 4 regimes
  2. if a < -1.0696516556697603e+105 or -6.647028763193772e+79 < a < -5.908454188501267e+54 or 2.1626082248080705e+61 < a

    1. Initial program 37.1

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

      \[\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-identity37.1

      \[\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-frac37.4

      \[\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. Simplified37.4

      \[\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 0 26.3

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

    if -1.0696516556697603e+105 < a < -6.647028763193772e+79 or -1365037.0076629713 < a < -1.8954215026127012e-14 or 1.3809015548453315e-200 < a < 1.0843459734110021e-132

    1. Initial program 21.0

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

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

      \[\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 inf 23.6

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

    if -5.908454188501267e+54 < a < -1365037.0076629713

    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-inv21.9

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

    if -1.8954215026127012e-14 < a < 1.3809015548453315e-200 or 1.0843459734110021e-132 < a < 2.1626082248080705e+61

    1. Initial program 19.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. Using strategy rm
    3. Applied div-sub19.4

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

      \[\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. Using strategy rm
    7. Applied associate-/r/15.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.06965165566976033823472063755939570788 \cdot 10^{105}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;a \le -6.647028763193771608577656210051197189253 \cdot 10^{79}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;a \le -5.908454188501267002593291613176370164849 \cdot 10^{54}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \mathbf{elif}\;a \le -1365037.00766297127120196819305419921875:\\ \;\;\;\;\left(\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\right) \cdot \frac{1}{\left(x + t\right) + y}\\ \mathbf{elif}\;a \le -1.895421502612701232401673873582106236223 \cdot 10^{-14}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;a \le 1.380901554845331477817825572366401542513 \cdot 10^{-200}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{elif}\;a \le 1.084345973411002110707221228148213091302 \cdot 10^{-132}:\\ \;\;\;\;z - \frac{y}{\frac{\left(x + t\right) + y}{b}}\\ \mathbf{elif}\;a \le 2.162608224808070531691010276609765583335 \cdot 10^{61}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + \left(t + y\right) \cdot a}{\left(x + t\right) + y} - \frac{y}{\left(x + t\right) + y} \cdot b\\ \mathbf{else}:\\ \;\;\;\;a - y \cdot \frac{b}{\left(x + t\right) + y}\\ \end{array}\]

Reproduce

herbie shell --seed 2019294 
(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.5813117084150564e153) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 1.2285964308315609e82) (/ 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)))