Average Error: 10.9 → 5.9
Time: 5.6s
Precision: binary64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;y \leq -6.463475984187357 \cdot 10^{+161}:\\ \;\;\;\;0.5 \cdot \left(\frac{{\left(-x\right)}^{x} \cdot {\left(\frac{-1}{y}\right)}^{x}}{y \cdot y} \cdot \left(x \cdot x + {x}^{3}\right)\right) + \left(\frac{{\left(-x\right)}^{x} \cdot {\left(\frac{-1}{y}\right)}^{x}}{x} - x \cdot \frac{{\left(-x\right)}^{x} \cdot {\left(\frac{-1}{y}\right)}^{x}}{y}\right)\\ \mathbf{elif}\;y \leq 317.3168173800605:\\ \;\;\;\;{\left(\sqrt[3]{\frac{x}{y + x}} \cdot \sqrt[3]{\frac{x}{y + x}}\right)}^{x} \cdot \frac{{\left(\sqrt[3]{\frac{x}{y + x}}\right)}^{x}}{x}\\ \mathbf{elif}\;y \leq 2.397614431801766 \cdot 10^{+48} \lor \neg \left(y \leq 3.2195260757207784 \cdot 10^{+85}\right) \land y \leq 3.955643581924325 \cdot 10^{+113}:\\ \;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{\sqrt{x}}{\sqrt{y + x}}\right)}^{x} \cdot {\left(\frac{\sqrt{x}}{\sqrt{y + x}}\right)}^{x}}{x}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;y \leq -6.463475984187357 \cdot 10^{+161}:\\
\;\;\;\;0.5 \cdot \left(\frac{{\left(-x\right)}^{x} \cdot {\left(\frac{-1}{y}\right)}^{x}}{y \cdot y} \cdot \left(x \cdot x + {x}^{3}\right)\right) + \left(\frac{{\left(-x\right)}^{x} \cdot {\left(\frac{-1}{y}\right)}^{x}}{x} - x \cdot \frac{{\left(-x\right)}^{x} \cdot {\left(\frac{-1}{y}\right)}^{x}}{y}\right)\\

\mathbf{elif}\;y \leq 317.3168173800605:\\
\;\;\;\;{\left(\sqrt[3]{\frac{x}{y + x}} \cdot \sqrt[3]{\frac{x}{y + x}}\right)}^{x} \cdot \frac{{\left(\sqrt[3]{\frac{x}{y + x}}\right)}^{x}}{x}\\

\mathbf{elif}\;y \leq 2.397614431801766 \cdot 10^{+48} \lor \neg \left(y \leq 3.2195260757207784 \cdot 10^{+85}\right) \land y \leq 3.955643581924325 \cdot 10^{+113}:\\
\;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\right)\\

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

\end{array}
(FPCore (x y) :precision binary64 (/ (exp (* x (log (/ x (+ x y))))) x))
(FPCore (x y)
 :precision binary64
 (if (<= y -6.463475984187357e+161)
   (+
    (*
     0.5
     (*
      (/ (* (pow (- x) x) (pow (/ -1.0 y) x)) (* y y))
      (+ (* x x) (pow x 3.0))))
    (-
     (/ (* (pow (- x) x) (pow (/ -1.0 y) x)) x)
     (* x (/ (* (pow (- x) x) (pow (/ -1.0 y) x)) y))))
   (if (<= y 317.3168173800605)
     (*
      (pow (* (cbrt (/ x (+ y x))) (cbrt (/ x (+ y x)))) x)
      (/ (pow (cbrt (/ x (+ y x))) x) x))
     (if (or (<= y 2.397614431801766e+48)
             (and (not (<= y 3.2195260757207784e+85))
                  (<= y 3.955643581924325e+113)))
       (log (exp (/ (pow (/ x (+ y x)) x) x)))
       (/
        (*
         (pow (/ (sqrt x) (sqrt (+ y x))) x)
         (pow (/ (sqrt x) (sqrt (+ y x))) x))
        x)))))
double code(double x, double y) {
	return (((double) exp(((double) (x * ((double) log((x / ((double) (x + y))))))))) / x);
}
double code(double x, double y) {
	double tmp;
	if ((y <= -6.463475984187357e+161)) {
		tmp = ((double) (((double) (0.5 * ((double) ((((double) (((double) pow(((double) -(x)), x)) * ((double) pow((-1.0 / y), x)))) / ((double) (y * y))) * ((double) (((double) (x * x)) + ((double) pow(x, 3.0)))))))) + ((double) ((((double) (((double) pow(((double) -(x)), x)) * ((double) pow((-1.0 / y), x)))) / x) - ((double) (x * (((double) (((double) pow(((double) -(x)), x)) * ((double) pow((-1.0 / y), x)))) / y)))))));
	} else {
		double tmp_1;
		if ((y <= 317.3168173800605)) {
			tmp_1 = ((double) (((double) pow(((double) (((double) cbrt((x / ((double) (y + x))))) * ((double) cbrt((x / ((double) (y + x))))))), x)) * (((double) pow(((double) cbrt((x / ((double) (y + x))))), x)) / x)));
		} else {
			double tmp_2;
			if (((y <= 2.397614431801766e+48) || (!(y <= 3.2195260757207784e+85) && (y <= 3.955643581924325e+113)))) {
				tmp_2 = ((double) log(((double) exp((((double) pow((x / ((double) (y + x))), x)) / x)))));
			} else {
				tmp_2 = (((double) (((double) pow((((double) sqrt(x)) / ((double) sqrt(((double) (y + x))))), x)) * ((double) pow((((double) sqrt(x)) / ((double) sqrt(((double) (y + x))))), x)))) / x);
			}
			tmp_1 = tmp_2;
		}
		tmp = tmp_1;
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.9
Target7.9
Herbie5.9
\[\begin{array}{l} \mathbf{if}\;y < -3.7311844206647956 \cdot 10^{+94}:\\ \;\;\;\;\frac{e^{\frac{-1}{y}}}{x}\\ \mathbf{elif}\;y < 2.817959242728288 \cdot 10^{+37}:\\ \;\;\;\;\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\\ \mathbf{elif}\;y < 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 < -6.4634759841873574e161

    1. Initial program Error: 44.0 bits

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. SimplifiedError: 44.0 bits

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

      \[\leadsto \color{blue}{\left(0.5 \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(0.5 \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. SimplifiedError: 0.0 bits

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

    if -6.4634759841873574e161 < y < 317.316817380060513

    1. Initial program Error: 1.8 bits

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. SimplifiedError: 1.8 bits

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

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

      \[\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-downError: 1.8 bits

      \[\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-fracError: 1.8 bits

      \[\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. SimplifiedError: 1.8 bits

      \[\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 317.316817380060513 < y < 2.39761443180176605e48 or 3.2195260757207784e85 < y < 3.95564358192432533e113

    1. Initial program Error: 35.8 bits

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. SimplifiedError: 35.8 bits

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

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

    if 2.39761443180176605e48 < y < 3.2195260757207784e85 or 3.95564358192432533e113 < y

    1. Initial program Error: 30.6 bits

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. SimplifiedError: 30.5 bits

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

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

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

      \[\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-downError: 18.8 bits

      \[\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 simplificationError: 5.9 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.463475984187357 \cdot 10^{+161}:\\ \;\;\;\;0.5 \cdot \left(\frac{{\left(-x\right)}^{x} \cdot {\left(\frac{-1}{y}\right)}^{x}}{y \cdot y} \cdot \left(x \cdot x + {x}^{3}\right)\right) + \left(\frac{{\left(-x\right)}^{x} \cdot {\left(\frac{-1}{y}\right)}^{x}}{x} - x \cdot \frac{{\left(-x\right)}^{x} \cdot {\left(\frac{-1}{y}\right)}^{x}}{y}\right)\\ \mathbf{elif}\;y \leq 317.3168173800605:\\ \;\;\;\;{\left(\sqrt[3]{\frac{x}{y + x}} \cdot \sqrt[3]{\frac{x}{y + x}}\right)}^{x} \cdot \frac{{\left(\sqrt[3]{\frac{x}{y + x}}\right)}^{x}}{x}\\ \mathbf{elif}\;y \leq 2.397614431801766 \cdot 10^{+48} \lor \neg \left(y \leq 3.2195260757207784 \cdot 10^{+85}\right) \land y \leq 3.955643581924325 \cdot 10^{+113}:\\ \;\;\;\;\log \left(e^{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{\sqrt{x}}{\sqrt{y + x}}\right)}^{x} \cdot {\left(\frac{\sqrt{x}}{\sqrt{y + x}}\right)}^{x}}{x}\\ \end{array}\]

Reproduce

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