Average Error: 11.5 → 1.8
Time: 19.8s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -16.17024727004499240479162835981696844101:\\ \;\;\;\;\sqrt{e^{-y}} \cdot \frac{\sqrt{e^{-y}}}{x}\\ \mathbf{elif}\;x \le 8.114686302170449394566276168916374444962:\\ \;\;\;\;\frac{{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}^{x}}{\frac{x}{{\left(\frac{\sqrt[3]{x}}{x + y}\right)}^{x}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\sqrt{e^{-y}}} \cdot \frac{{\left(\sqrt{\sqrt{e^{-y}}}\right)}^{3}}{x}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \le -16.17024727004499240479162835981696844101:\\
\;\;\;\;\sqrt{e^{-y}} \cdot \frac{\sqrt{e^{-y}}}{x}\\

\mathbf{elif}\;x \le 8.114686302170449394566276168916374444962:\\
\;\;\;\;\frac{{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}^{x}}{\frac{x}{{\left(\frac{\sqrt[3]{x}}{x + y}\right)}^{x}}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\sqrt{e^{-y}}} \cdot \frac{{\left(\sqrt{\sqrt{e^{-y}}}\right)}^{3}}{x}\\

\end{array}
double f(double x, double y) {
        double r261435 = x;
        double r261436 = y;
        double r261437 = r261435 + r261436;
        double r261438 = r261435 / r261437;
        double r261439 = log(r261438);
        double r261440 = r261435 * r261439;
        double r261441 = exp(r261440);
        double r261442 = r261441 / r261435;
        return r261442;
}

double f(double x, double y) {
        double r261443 = x;
        double r261444 = -16.170247270044992;
        bool r261445 = r261443 <= r261444;
        double r261446 = y;
        double r261447 = -r261446;
        double r261448 = exp(r261447);
        double r261449 = sqrt(r261448);
        double r261450 = r261449 / r261443;
        double r261451 = r261449 * r261450;
        double r261452 = 8.11468630217045;
        bool r261453 = r261443 <= r261452;
        double r261454 = cbrt(r261443);
        double r261455 = r261454 * r261454;
        double r261456 = pow(r261455, r261443);
        double r261457 = r261443 + r261446;
        double r261458 = r261454 / r261457;
        double r261459 = pow(r261458, r261443);
        double r261460 = r261443 / r261459;
        double r261461 = r261456 / r261460;
        double r261462 = sqrt(r261449);
        double r261463 = 3.0;
        double r261464 = pow(r261462, r261463);
        double r261465 = r261464 / r261443;
        double r261466 = r261462 * r261465;
        double r261467 = r261453 ? r261461 : r261466;
        double r261468 = r261445 ? r261451 : r261467;
        return r261468;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.5
Target8.2
Herbie1.8
\[\begin{array}{l} \mathbf{if}\;y \lt -3.73118442066479561492798134439269393419 \cdot 10^{94}:\\ \;\;\;\;\frac{e^{\frac{-1}{y}}}{x}\\ \mathbf{elif}\;y \lt 28179592427282878868860376020282245120:\\ \;\;\;\;\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\\ \mathbf{elif}\;y \lt 2.347387415166997963747840232163110922613 \cdot 10^{178}:\\ \;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\frac{-1}{y}}}{x}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if x < -16.170247270044992

    1. Initial program 11.5

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Simplified11.5

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\]
    3. Taylor expanded around inf 0.1

      \[\leadsto \frac{\color{blue}{e^{-y}}}{x}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity0.1

      \[\leadsto \frac{e^{-y}}{\color{blue}{1 \cdot x}}\]
    6. Applied add-sqr-sqrt0.1

      \[\leadsto \frac{\color{blue}{\sqrt{e^{-y}} \cdot \sqrt{e^{-y}}}}{1 \cdot x}\]
    7. Applied times-frac0.1

      \[\leadsto \color{blue}{\frac{\sqrt{e^{-y}}}{1} \cdot \frac{\sqrt{e^{-y}}}{x}}\]
    8. Simplified0.1

      \[\leadsto \color{blue}{\sqrt{e^{-y}}} \cdot \frac{\sqrt{e^{-y}}}{x}\]

    if -16.170247270044992 < x < 8.11468630217045

    1. Initial program 12.3

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Simplified12.3

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity12.3

      \[\leadsto \frac{{\left(\frac{x}{\color{blue}{1 \cdot \left(x + y\right)}}\right)}^{x}}{x}\]
    5. Applied add-cube-cbrt12.3

      \[\leadsto \frac{{\left(\frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{1 \cdot \left(x + y\right)}\right)}^{x}}{x}\]
    6. Applied times-frac12.3

      \[\leadsto \frac{{\color{blue}{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{1} \cdot \frac{\sqrt[3]{x}}{x + y}\right)}}^{x}}{x}\]
    7. Applied unpow-prod-down3.7

      \[\leadsto \frac{\color{blue}{{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{1}\right)}^{x} \cdot {\left(\frac{\sqrt[3]{x}}{x + y}\right)}^{x}}}{x}\]
    8. Applied associate-/l*3.7

      \[\leadsto \color{blue}{\frac{{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{1}\right)}^{x}}{\frac{x}{{\left(\frac{\sqrt[3]{x}}{x + y}\right)}^{x}}}}\]

    if 8.11468630217045 < x

    1. Initial program 10.3

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Simplified10.3

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\]
    3. Taylor expanded around inf 0.1

      \[\leadsto \frac{\color{blue}{e^{-y}}}{x}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity0.1

      \[\leadsto \frac{e^{-y}}{\color{blue}{1 \cdot x}}\]
    6. Applied add-sqr-sqrt0.1

      \[\leadsto \frac{\color{blue}{\sqrt{e^{-y}} \cdot \sqrt{e^{-y}}}}{1 \cdot x}\]
    7. Applied times-frac0.1

      \[\leadsto \color{blue}{\frac{\sqrt{e^{-y}}}{1} \cdot \frac{\sqrt{e^{-y}}}{x}}\]
    8. Simplified0.1

      \[\leadsto \color{blue}{\sqrt{e^{-y}}} \cdot \frac{\sqrt{e^{-y}}}{x}\]
    9. Using strategy rm
    10. Applied add-sqr-sqrt0.1

      \[\leadsto \sqrt{\color{blue}{\sqrt{e^{-y}} \cdot \sqrt{e^{-y}}}} \cdot \frac{\sqrt{e^{-y}}}{x}\]
    11. Applied sqrt-prod0.1

      \[\leadsto \color{blue}{\left(\sqrt{\sqrt{e^{-y}}} \cdot \sqrt{\sqrt{e^{-y}}}\right)} \cdot \frac{\sqrt{e^{-y}}}{x}\]
    12. Applied associate-*l*0.1

      \[\leadsto \color{blue}{\sqrt{\sqrt{e^{-y}}} \cdot \left(\sqrt{\sqrt{e^{-y}}} \cdot \frac{\sqrt{e^{-y}}}{x}\right)}\]
    13. Simplified0.1

      \[\leadsto \sqrt{\sqrt{e^{-y}}} \cdot \color{blue}{\frac{{\left(\sqrt{\sqrt{e^{-y}}}\right)}^{3}}{x}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -16.17024727004499240479162835981696844101:\\ \;\;\;\;\sqrt{e^{-y}} \cdot \frac{\sqrt{e^{-y}}}{x}\\ \mathbf{elif}\;x \le 8.114686302170449394566276168916374444962:\\ \;\;\;\;\frac{{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}^{x}}{\frac{x}{{\left(\frac{\sqrt[3]{x}}{x + y}\right)}^{x}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\sqrt{e^{-y}}} \cdot \frac{{\left(\sqrt{\sqrt{e^{-y}}}\right)}^{3}}{x}\\ \end{array}\]

Reproduce

herbie shell --seed 2019322 +o rules:numerics
(FPCore (x y)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, F"
  :precision binary64

  :herbie-target
  (if (< y -3.7311844206647956e+94) (/ (exp (/ -1 y)) x) (if (< y 2.817959242728288e+37) (/ (pow (/ x (+ y x)) x) x) (if (< y 2.347387415166998e+178) (log (exp (/ (pow (/ x (+ y x)) x) x))) (/ (exp (/ -1 y)) x))))

  (/ (exp (* x (log (/ x (+ x y))))) x))