Average Error: 11.5 → 0.1
Time: 21.6s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -6855000109145468998274891760271360:\\ \;\;\;\;\sqrt{e^{-y}} \cdot \frac{\sqrt{e^{-y}}}{x}\\ \mathbf{elif}\;x \le 51.97466445904304066516488092020153999329:\\ \;\;\;\;\frac{e^{x \cdot \left(2 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right) + x \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{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 -6855000109145468998274891760271360:\\
\;\;\;\;\sqrt{e^{-y}} \cdot \frac{\sqrt{e^{-y}}}{x}\\

\mathbf{elif}\;x \le 51.97466445904304066516488092020153999329:\\
\;\;\;\;\frac{e^{x \cdot \left(2 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right) + x \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{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 r241335 = x;
        double r241336 = y;
        double r241337 = r241335 + r241336;
        double r241338 = r241335 / r241337;
        double r241339 = log(r241338);
        double r241340 = r241335 * r241339;
        double r241341 = exp(r241340);
        double r241342 = r241341 / r241335;
        return r241342;
}

double f(double x, double y) {
        double r241343 = x;
        double r241344 = -6.855000109145469e+33;
        bool r241345 = r241343 <= r241344;
        double r241346 = y;
        double r241347 = -r241346;
        double r241348 = exp(r241347);
        double r241349 = sqrt(r241348);
        double r241350 = r241349 / r241343;
        double r241351 = r241349 * r241350;
        double r241352 = 51.97466445904304;
        bool r241353 = r241343 <= r241352;
        double r241354 = 2.0;
        double r241355 = cbrt(r241343);
        double r241356 = r241343 + r241346;
        double r241357 = cbrt(r241356);
        double r241358 = r241355 / r241357;
        double r241359 = log(r241358);
        double r241360 = r241354 * r241359;
        double r241361 = r241343 * r241360;
        double r241362 = r241343 * r241359;
        double r241363 = r241361 + r241362;
        double r241364 = exp(r241363);
        double r241365 = r241364 / r241343;
        double r241366 = sqrt(r241349);
        double r241367 = 3.0;
        double r241368 = pow(r241366, r241367);
        double r241369 = r241368 / r241343;
        double r241370 = r241366 * r241369;
        double r241371 = r241353 ? r241365 : r241370;
        double r241372 = r241345 ? r241351 : r241371;
        return r241372;
}

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
Herbie0.1
\[\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 < -6.855000109145469e+33

    1. Initial program 12.4

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Taylor expanded around inf 0.0

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

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

      \[\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 -6.855000109145469e+33 < x < 51.97466445904304

    1. Initial program 11.8

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt13.3

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

      \[\leadsto \frac{e^{x \cdot \log \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}\]
    5. Applied times-frac11.8

      \[\leadsto \frac{e^{x \cdot \log \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}\]
    6. Applied log-prod2.7

      \[\leadsto \frac{e^{x \cdot \color{blue}{\left(\log \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}}{x}\]
    7. Applied distribute-lft-in2.7

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

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

    if 51.97466445904304 < x

    1. Initial program 10.4

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Taylor expanded around inf 0.1

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

      \[\leadsto \color{blue}{\frac{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 simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -6855000109145468998274891760271360:\\ \;\;\;\;\sqrt{e^{-y}} \cdot \frac{\sqrt{e^{-y}}}{x}\\ \mathbf{elif}\;x \le 51.97466445904304066516488092020153999329:\\ \;\;\;\;\frac{e^{x \cdot \left(2 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right) + x \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{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 
(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))