Average Error: 11.1 → 5.7
Time: 11.0s
Precision: binary64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;y \le -7.472833578446224 \cdot 10^{140}:\\ \;\;\;\;\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 2878.0393812193179:\\ \;\;\;\;\frac{1}{\frac{x}{{\left(\frac{x}{x + y}\right)}^{x}}}\\ \mathbf{elif}\;y \le 7.53931162818783628 \cdot 10^{68}:\\ \;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\right)\\ \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 -7.472833578446224 \cdot 10^{140}:\\
\;\;\;\;\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 2878.0393812193179:\\
\;\;\;\;\frac{1}{\frac{x}{{\left(\frac{x}{x + y}\right)}^{x}}}\\

\mathbf{elif}\;y \le 7.53931162818783628 \cdot 10^{68}:\\
\;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\right)\\

\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 <= -7.472833578446224e+140)) {
		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 <= 2878.039381219318)) {
			VAR_1 = ((double) (1.0 / ((double) (x / ((double) pow(((double) (x / ((double) (x + y)))), x))))));
		} else {
			double VAR_2;
			if ((y <= 7.539311628187836e+68)) {
				VAR_2 = ((double) log(((double) exp(((double) (((double) pow(((double) (x / ((double) (x + y)))), x)) / x))))));
			} else {
				VAR_2 = ((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_1 = VAR_2;
		}
		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.1
Target8.0
Herbie5.7
\[\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 4 regimes
  2. if y < -7.472833578446224e140

    1. Initial program 41.7

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

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

      \[\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.1

      \[\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 -7.472833578446224e140 < y < 2878.0393812193179

    1. Initial program 1.5

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

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\]
    3. Using strategy rm
    4. Applied clear-num1.5

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

    if 2878.0393812193179 < y < 7.53931162818783628e68

    1. Initial program 36.6

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

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

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

    if 7.53931162818783628e68 < y

    1. Initial program 31.6

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

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

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

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

      \[\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-down18.9

      \[\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 4 regimes into one program.
  4. Final simplification5.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -7.472833578446224 \cdot 10^{140}:\\ \;\;\;\;\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 2878.0393812193179:\\ \;\;\;\;\frac{1}{\frac{x}{{\left(\frac{x}{x + y}\right)}^{x}}}\\ \mathbf{elif}\;y \le 7.53931162818783628 \cdot 10^{68}:\\ \;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\right)\\ \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 2020147 
(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))