Average Error: 26.7 → 20.9
Time: 37.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}\;a \le -1.686294910857727603853458927660821310409 \cdot 10^{187}:\\ \;\;\;\;a - \frac{y}{t + \left(x + y\right)} \cdot b\\ \mathbf{elif}\;a \le -249617.478927284828387200832366943359375:\\ \;\;\;\;z - \frac{y}{t + \left(x + y\right)} \cdot b\\ \mathbf{elif}\;a \le -2.54215477075563535815847022596895949797 \cdot 10^{-219}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right) + \left(t + y\right) \cdot a}{t + \left(x + y\right)} - b \cdot \left(y \cdot \frac{1}{t + \left(x + y\right)}\right)\\ \mathbf{elif}\;a \le 3.942386611488526229797254315468748666486 \cdot 10^{-178}:\\ \;\;\;\;z - \frac{y}{t + \left(x + y\right)} \cdot b\\ \mathbf{elif}\;a \le 8.407686055131771870633666134478145741125 \cdot 10^{70}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right) + \left(t + y\right) \cdot a}{t + \left(x + y\right)} - b \cdot \left(y \cdot \frac{1}{t + \left(x + y\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{t + \left(x + 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}\;a \le -1.686294910857727603853458927660821310409 \cdot 10^{187}:\\
\;\;\;\;a - \frac{y}{t + \left(x + y\right)} \cdot b\\

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

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

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r39550567 = x;
        double r39550568 = y;
        double r39550569 = r39550567 + r39550568;
        double r39550570 = z;
        double r39550571 = r39550569 * r39550570;
        double r39550572 = t;
        double r39550573 = r39550572 + r39550568;
        double r39550574 = a;
        double r39550575 = r39550573 * r39550574;
        double r39550576 = r39550571 + r39550575;
        double r39550577 = b;
        double r39550578 = r39550568 * r39550577;
        double r39550579 = r39550576 - r39550578;
        double r39550580 = r39550567 + r39550572;
        double r39550581 = r39550580 + r39550568;
        double r39550582 = r39550579 / r39550581;
        return r39550582;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r39550583 = a;
        double r39550584 = -1.6862949108577276e+187;
        bool r39550585 = r39550583 <= r39550584;
        double r39550586 = y;
        double r39550587 = t;
        double r39550588 = x;
        double r39550589 = r39550588 + r39550586;
        double r39550590 = r39550587 + r39550589;
        double r39550591 = r39550586 / r39550590;
        double r39550592 = b;
        double r39550593 = r39550591 * r39550592;
        double r39550594 = r39550583 - r39550593;
        double r39550595 = -249617.47892728483;
        bool r39550596 = r39550583 <= r39550595;
        double r39550597 = z;
        double r39550598 = r39550597 - r39550593;
        double r39550599 = -2.5421547707556354e-219;
        bool r39550600 = r39550583 <= r39550599;
        double r39550601 = r39550597 * r39550589;
        double r39550602 = r39550587 + r39550586;
        double r39550603 = r39550602 * r39550583;
        double r39550604 = r39550601 + r39550603;
        double r39550605 = r39550604 / r39550590;
        double r39550606 = 1.0;
        double r39550607 = r39550606 / r39550590;
        double r39550608 = r39550586 * r39550607;
        double r39550609 = r39550592 * r39550608;
        double r39550610 = r39550605 - r39550609;
        double r39550611 = 3.942386611488526e-178;
        bool r39550612 = r39550583 <= r39550611;
        double r39550613 = 8.407686055131772e+70;
        bool r39550614 = r39550583 <= r39550613;
        double r39550615 = r39550614 ? r39550610 : r39550594;
        double r39550616 = r39550612 ? r39550598 : r39550615;
        double r39550617 = r39550600 ? r39550610 : r39550616;
        double r39550618 = r39550596 ? r39550598 : r39550617;
        double r39550619 = r39550585 ? r39550594 : r39550618;
        return r39550619;
}

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.1
Herbie20.9
\[\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 a < -1.6862949108577276e+187 or 8.407686055131772e+70 < a

    1. Initial program 40.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. Simplified40.4

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

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

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

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

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

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

    if -1.6862949108577276e+187 < a < -249617.47892728483 or -2.5421547707556354e-219 < a < 3.942386611488526e-178

    1. Initial program 23.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. Simplified23.7

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

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

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

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

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

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

    if -249617.47892728483 < a < -2.5421547707556354e-219 or 3.942386611488526e-178 < a < 8.407686055131772e+70

    1. Initial program 18.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. Simplified18.8

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.686294910857727603853458927660821310409 \cdot 10^{187}:\\ \;\;\;\;a - \frac{y}{t + \left(x + y\right)} \cdot b\\ \mathbf{elif}\;a \le -249617.478927284828387200832366943359375:\\ \;\;\;\;z - \frac{y}{t + \left(x + y\right)} \cdot b\\ \mathbf{elif}\;a \le -2.54215477075563535815847022596895949797 \cdot 10^{-219}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right) + \left(t + y\right) \cdot a}{t + \left(x + y\right)} - b \cdot \left(y \cdot \frac{1}{t + \left(x + y\right)}\right)\\ \mathbf{elif}\;a \le 3.942386611488526229797254315468748666486 \cdot 10^{-178}:\\ \;\;\;\;z - \frac{y}{t + \left(x + y\right)} \cdot b\\ \mathbf{elif}\;a \le 8.407686055131771870633666134478145741125 \cdot 10^{70}:\\ \;\;\;\;\frac{z \cdot \left(x + y\right) + \left(t + y\right) \cdot a}{t + \left(x + y\right)} - b \cdot \left(y \cdot \frac{1}{t + \left(x + y\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;a - \frac{y}{t + \left(x + y\right)} \cdot b\\ \end{array}\]

Reproduce

herbie shell --seed 2019200 
(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)))