Average Error: 11.0 → 7.0
Time: 6.7s
Precision: binary64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.81956904942398704 \cdot 10^{43}:\\ \;\;\;\;\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 245.52726426991933:\\ \;\;\;\;\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}\\ \mathbf{elif}\;y \le 1.372280631815179 \cdot 10^{103}:\\ \;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\right)\\ \mathbf{elif}\;y \le 2.0305632942508773 \cdot 10^{116}:\\ \;\;\;\;\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\right)\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;y \le -1.81956904942398704 \cdot 10^{43}:\\
\;\;\;\;\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 245.52726426991933:\\
\;\;\;\;\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}\\

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

\mathbf{elif}\;y \le 2.0305632942508773 \cdot 10^{116}:\\
\;\;\;\;\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}\\

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

\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 <= -1.819569049423987e+43)) {
		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 <= 245.52726426991933)) {
			VAR_1 = ((double) (((double) pow(((double) (x / ((double) (x + y)))), x)) / x));
		} else {
			double VAR_2;
			if ((y <= 1.3722806318151791e+103)) {
				VAR_2 = ((double) log(((double) exp(((double) (((double) pow(((double) (x / ((double) (x + y)))), x)) / x))))));
			} else {
				double VAR_3;
				if ((y <= 2.0305632942508773e+116)) {
					VAR_3 = ((double) (((double) pow(((double) (x / ((double) (x + y)))), x)) / x));
				} else {
					VAR_3 = ((double) log(((double) exp(((double) (((double) pow(((double) (x / ((double) (x + y)))), x)) / x))))));
				}
				VAR_2 = VAR_3;
			}
			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.0
Target7.9
Herbie7.0
\[\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 < -1.81956904942398704e43

    1. Initial program 32.6

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

      \[\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 -1.81956904942398704e43 < y < 245.52726426991933 or 1.372280631815179e103 < y < 2.0305632942508773e116

    1. Initial program 1.7

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

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

    if 245.52726426991933 < y < 1.372280631815179e103 or 2.0305632942508773e116 < y

    1. Initial program 32.9

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

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

      \[\leadsto \color{blue}{\log \left(e^{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification7.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.81956904942398704 \cdot 10^{43}:\\ \;\;\;\;\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 245.52726426991933:\\ \;\;\;\;\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}\\ \mathbf{elif}\;y \le 1.372280631815179 \cdot 10^{103}:\\ \;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\right)\\ \mathbf{elif}\;y \le 2.0305632942508773 \cdot 10^{116}:\\ \;\;\;\;\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020175 
(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))