Average Error: 11.4 → 6.3
Time: 5.5s
Precision: binary64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.5267709347995916 \cdot 10^{46}:\\ \;\;\;\;\frac{1}{2} \cdot \left(\frac{e^{x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right)} \cdot {x}^{2}}{{y}^{2}} + \frac{e^{x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right)} \cdot {x}^{3}}{{y}^{2}}\right) + \left(\frac{e^{x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right)}}{x} - \frac{e^{x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right)} \cdot x}{y}\right)\\ \mathbf{elif}\;y \le 4.1436239237094987 \cdot 10^{37}:\\ \;\;\;\;{\left(\sqrt[3]{\frac{x}{x + y}} \cdot \sqrt[3]{\frac{x}{x + y}}\right)}^{x} \cdot \frac{{\left(\sqrt[3]{\frac{x}{x + y}}\right)}^{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{\sqrt{x}}{\sqrt{x + y}}\right)}^{x} \cdot {\left(\frac{\sqrt{x}}{\sqrt{x + y}}\right)}^{x}}{x}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;y \le -2.5267709347995916 \cdot 10^{46}:\\
\;\;\;\;\frac{1}{2} \cdot \left(\frac{e^{x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right)} \cdot {x}^{2}}{{y}^{2}} + \frac{e^{x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right)} \cdot {x}^{3}}{{y}^{2}}\right) + \left(\frac{e^{x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right)}}{x} - \frac{e^{x \cdot \left(\log \left(-1 \cdot x\right) + \log \left(\frac{-1}{y}\right)\right)} \cdot x}{y}\right)\\

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

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

\end{array}
double code(double x, double y) {
	return ((double) (((double) exp(((double) (x * ((double) log(((double) (x / ((double) (x + y)))))))))) / x));
}
double code(double x, double y) {
	double VAR;
	if ((y <= -2.5267709347995916e+46)) {
		VAR = ((double) (((double) (0.5 * ((double) (((double) (((double) (((double) exp(((double) (x * ((double) (((double) log(((double) (-1.0 * x)))) + ((double) log(((double) (-1.0 / y)))))))))) * ((double) pow(x, 2.0)))) / ((double) pow(y, 2.0)))) + ((double) (((double) (((double) exp(((double) (x * ((double) (((double) log(((double) (-1.0 * x)))) + ((double) log(((double) (-1.0 / y)))))))))) * ((double) pow(x, 3.0)))) / ((double) pow(y, 2.0)))))))) + ((double) (((double) (((double) exp(((double) (x * ((double) (((double) log(((double) (-1.0 * x)))) + ((double) log(((double) (-1.0 / y)))))))))) / x)) - ((double) (((double) (((double) exp(((double) (x * ((double) (((double) log(((double) (-1.0 * x)))) + ((double) log(((double) (-1.0 / y)))))))))) * x)) / y))))));
	} else {
		double VAR_1;
		if ((y <= 4.1436239237094987e+37)) {
			VAR_1 = ((double) (((double) pow(((double) (((double) cbrt(((double) (x / ((double) (x + y)))))) * ((double) cbrt(((double) (x / ((double) (x + y)))))))), x)) * ((double) (((double) pow(((double) cbrt(((double) (x / ((double) (x + y)))))), x)) / x))));
		} else {
			VAR_1 = ((double) (((double) (((double) pow(((double) (((double) sqrt(x)) / ((double) sqrt(((double) (x + y)))))), x)) * ((double) pow(((double) (((double) sqrt(x)) / ((double) sqrt(((double) (x + y)))))), x)))) / x));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.0
Herbie6.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 y < -2.5267709347995916e46

    1. Initial program 34.1

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

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

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

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

    if -2.5267709347995916e46 < y < 4.1436239237094987e37

    1. Initial program 2.7

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

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

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

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

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

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

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

    if 4.1436239237094987e37 < y

    1. Initial program 32.7

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

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt32.6

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

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

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

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

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

Reproduce

herbie shell --seed 2020149 
(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.0 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.0 y)) x))))

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