Average Error: 27.0 → 7.7
Time: 19.3s
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}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \le -1.485966962889639314182950872628569480956 \cdot 10^{259} \lor \neg \left(\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \le 9.56574528958459179758686821776355245136 \cdot 10^{256}\right):\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{else}:\\ \;\;\;\;\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}\\ \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}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \le -1.485966962889639314182950872628569480956 \cdot 10^{259} \lor \neg \left(\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \le 9.56574528958459179758686821776355245136 \cdot 10^{256}\right):\\
\;\;\;\;\left(a + z\right) - b\\

\mathbf{else}:\\
\;\;\;\;\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}\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r538392 = x;
        double r538393 = y;
        double r538394 = r538392 + r538393;
        double r538395 = z;
        double r538396 = r538394 * r538395;
        double r538397 = t;
        double r538398 = r538397 + r538393;
        double r538399 = a;
        double r538400 = r538398 * r538399;
        double r538401 = r538396 + r538400;
        double r538402 = b;
        double r538403 = r538393 * r538402;
        double r538404 = r538401 - r538403;
        double r538405 = r538392 + r538397;
        double r538406 = r538405 + r538393;
        double r538407 = r538404 / r538406;
        return r538407;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r538408 = x;
        double r538409 = y;
        double r538410 = r538408 + r538409;
        double r538411 = z;
        double r538412 = r538410 * r538411;
        double r538413 = t;
        double r538414 = r538413 + r538409;
        double r538415 = a;
        double r538416 = r538414 * r538415;
        double r538417 = r538412 + r538416;
        double r538418 = b;
        double r538419 = r538409 * r538418;
        double r538420 = r538417 - r538419;
        double r538421 = r538408 + r538413;
        double r538422 = r538421 + r538409;
        double r538423 = r538420 / r538422;
        double r538424 = -1.4859669628896393e+259;
        bool r538425 = r538423 <= r538424;
        double r538426 = 9.565745289584592e+256;
        bool r538427 = r538423 <= r538426;
        double r538428 = !r538427;
        bool r538429 = r538425 || r538428;
        double r538430 = r538415 + r538411;
        double r538431 = r538430 - r538418;
        double r538432 = r538417 / r538422;
        double r538433 = -r538419;
        double r538434 = r538433 / r538422;
        double r538435 = r538432 + r538434;
        double r538436 = r538429 ? r538431 : r538435;
        return r538436;
}

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

Original27.0
Target11.3
Herbie7.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.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 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) < -1.4859669628896393e+259 or 9.565745289584592e+256 < (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))

    1. Initial program 60.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 clear-num60.5

      \[\leadsto \color{blue}{\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}}}\]
    4. Taylor expanded around 0 17.1

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

    if -1.4859669628896393e+259 < (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) < 9.565745289584592e+256

    1. Initial program 0.3

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

      \[\leadsto \color{blue}{\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}}}\]
    4. Using strategy rm
    5. Applied div-inv0.5

      \[\leadsto \frac{1}{\color{blue}{\left(\left(x + t\right) + y\right) \cdot \frac{1}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}}\]
    6. Applied add-cube-cbrt0.5

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

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

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

      \[\leadsto \frac{1}{\left(x + t\right) + y} \cdot \color{blue}{\left(\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\right)}\]
    10. Using strategy rm
    11. Applied sub-neg0.4

      \[\leadsto \frac{1}{\left(x + t\right) + y} \cdot \color{blue}{\left(\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) + \left(-y \cdot b\right)\right)}\]
    12. Applied distribute-lft-in0.4

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

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

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

    \[\leadsto \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} \le -1.485966962889639314182950872628569480956 \cdot 10^{259} \lor \neg \left(\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \le 9.56574528958459179758686821776355245136 \cdot 10^{256}\right):\\ \;\;\;\;\left(a + z\right) - b\\ \mathbf{else}:\\ \;\;\;\;\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}\\ \end{array}\]

Reproduce

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