Average Error: 11.4 → 0.3
Time: 6.9s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -5.86066198976175052 \cdot 10^{64}:\\ \;\;\;\;\frac{e^{-1 \cdot y}}{x}\\ \mathbf{elif}\;x \le 0.0010876143661975072:\\ \;\;\;\;e^{\left(x \cdot 2\right) \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)} \cdot \frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot e^{y}}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \le -5.86066198976175052 \cdot 10^{64}:\\
\;\;\;\;\frac{e^{-1 \cdot y}}{x}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot e^{y}}\\

\end{array}
double f(double x, double y) {
        double r633401 = x;
        double r633402 = y;
        double r633403 = r633401 + r633402;
        double r633404 = r633401 / r633403;
        double r633405 = log(r633404);
        double r633406 = r633401 * r633405;
        double r633407 = exp(r633406);
        double r633408 = r633407 / r633401;
        return r633408;
}

double f(double x, double y) {
        double r633409 = x;
        double r633410 = -5.86066198976175e+64;
        bool r633411 = r633409 <= r633410;
        double r633412 = -1.0;
        double r633413 = y;
        double r633414 = r633412 * r633413;
        double r633415 = exp(r633414);
        double r633416 = r633415 / r633409;
        double r633417 = 0.0010876143661975072;
        bool r633418 = r633409 <= r633417;
        double r633419 = 2.0;
        double r633420 = r633409 * r633419;
        double r633421 = cbrt(r633409);
        double r633422 = r633409 + r633413;
        double r633423 = cbrt(r633422);
        double r633424 = r633421 / r633423;
        double r633425 = log(r633424);
        double r633426 = r633420 * r633425;
        double r633427 = exp(r633426);
        double r633428 = pow(r633424, r633409);
        double r633429 = r633428 / r633409;
        double r633430 = r633427 * r633429;
        double r633431 = 1.0;
        double r633432 = exp(r633413);
        double r633433 = r633409 * r633432;
        double r633434 = r633431 / r633433;
        double r633435 = r633418 ? r633430 : r633434;
        double r633436 = r633411 ? r633416 : r633435;
        return r633436;
}

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.4
Target8.5
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;y \lt -3.73118442066479561 \cdot 10^{94}:\\ \;\;\;\;\frac{e^{\frac{-1}{y}}}{x}\\ \mathbf{elif}\;y \lt 2.81795924272828789 \cdot 10^{37}:\\ \;\;\;\;\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\\ \mathbf{elif}\;y \lt 2.347387415166998 \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 < -5.86066198976175e+64

    1. Initial program 14.8

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

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

      \[\leadsto \frac{\color{blue}{e^{-y}}}{x}\]
    4. Simplified0.0

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

    if -5.86066198976175e+64 < x < 0.0010876143661975072

    1. Initial program 10.6

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right)}^{x}} \cdot \frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}{x}\]
    11. Using strategy rm
    12. Applied add-exp-log35.8

      \[\leadsto {\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \color{blue}{e^{\log \left(\sqrt[3]{x + y}\right)}}}\right)}^{x} \cdot \frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}{x}\]
    13. Applied add-exp-log35.8

      \[\leadsto {\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\color{blue}{e^{\log \left(\sqrt[3]{x + y}\right)}} \cdot e^{\log \left(\sqrt[3]{x + y}\right)}}\right)}^{x} \cdot \frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}{x}\]
    14. Applied prod-exp35.8

      \[\leadsto {\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\color{blue}{e^{\log \left(\sqrt[3]{x + y}\right) + \log \left(\sqrt[3]{x + y}\right)}}}\right)}^{x} \cdot \frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}{x}\]
    15. Applied add-exp-log35.8

      \[\leadsto {\left(\frac{\sqrt[3]{x} \cdot \color{blue}{e^{\log \left(\sqrt[3]{x}\right)}}}{e^{\log \left(\sqrt[3]{x + y}\right) + \log \left(\sqrt[3]{x + y}\right)}}\right)}^{x} \cdot \frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}{x}\]
    16. Applied add-exp-log35.8

      \[\leadsto {\left(\frac{\color{blue}{e^{\log \left(\sqrt[3]{x}\right)}} \cdot e^{\log \left(\sqrt[3]{x}\right)}}{e^{\log \left(\sqrt[3]{x + y}\right) + \log \left(\sqrt[3]{x + y}\right)}}\right)}^{x} \cdot \frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}{x}\]
    17. Applied prod-exp35.8

      \[\leadsto {\left(\frac{\color{blue}{e^{\log \left(\sqrt[3]{x}\right) + \log \left(\sqrt[3]{x}\right)}}}{e^{\log \left(\sqrt[3]{x + y}\right) + \log \left(\sqrt[3]{x + y}\right)}}\right)}^{x} \cdot \frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}{x}\]
    18. Applied div-exp35.8

      \[\leadsto {\color{blue}{\left(e^{\left(\log \left(\sqrt[3]{x}\right) + \log \left(\sqrt[3]{x}\right)\right) - \left(\log \left(\sqrt[3]{x + y}\right) + \log \left(\sqrt[3]{x + y}\right)\right)}\right)}}^{x} \cdot \frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}{x}\]
    19. Applied pow-exp34.8

      \[\leadsto \color{blue}{e^{\left(\left(\log \left(\sqrt[3]{x}\right) + \log \left(\sqrt[3]{x}\right)\right) - \left(\log \left(\sqrt[3]{x + y}\right) + \log \left(\sqrt[3]{x + y}\right)\right)\right) \cdot x}} \cdot \frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}{x}\]
    20. Simplified0.4

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

    if 0.0010876143661975072 < 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.3

      \[\leadsto \frac{\color{blue}{e^{-y}}}{x}\]
    4. Simplified0.3

      \[\leadsto \frac{\color{blue}{e^{-1 \cdot y}}}{x}\]
    5. Using strategy rm
    6. Applied clear-num0.3

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

      \[\leadsto \frac{1}{\color{blue}{x \cdot e^{y}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -5.86066198976175052 \cdot 10^{64}:\\ \;\;\;\;\frac{e^{-1 \cdot y}}{x}\\ \mathbf{elif}\;x \le 0.0010876143661975072:\\ \;\;\;\;e^{\left(x \cdot 2\right) \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)} \cdot \frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot e^{y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020034 +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))