Average Error: 11.1 → 5.1
Time: 5.8s
Precision: binary64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1947019381196716 \cdot 10^{+74}:\\ \;\;\;\;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 1.9116918545050105 \cdot 10^{+20}:\\ \;\;\;\;\frac{\left(\left({\left(\sqrt{\left|\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right|}\right)}^{x} \cdot {\left(\sqrt{\left|\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right|}\right)}^{x}\right) \cdot {\left(\sqrt{\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}}\right)}^{x}\right) \cdot {\left(\frac{x}{y + x}\right)}^{\left(0.5 \cdot x\right)}}{x}\\ \mathbf{elif}\;y \leq 1.3882841915962162 \cdot 10^{+254}:\\ \;\;\;\;\sqrt[3]{{\left(\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\right)}^{3}}\\ \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 -1.1947019381196716 \cdot 10^{+74}:\\
\;\;\;\;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 1.9116918545050105 \cdot 10^{+20}:\\
\;\;\;\;\frac{\left(\left({\left(\sqrt{\left|\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right|}\right)}^{x} \cdot {\left(\sqrt{\left|\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right|}\right)}^{x}\right) \cdot {\left(\sqrt{\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}}\right)}^{x}\right) \cdot {\left(\frac{x}{y + x}\right)}^{\left(0.5 \cdot x\right)}}{x}\\

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

\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 -1.1947019381196716e+74)
   (+
    (*
     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 1.9116918545050105e+20)
     (/
      (*
       (*
        (*
         (pow (sqrt (fabs (/ (cbrt x) (cbrt (+ y x))))) x)
         (pow (sqrt (fabs (/ (cbrt x) (cbrt (+ y x))))) x))
        (pow (sqrt (/ (cbrt x) (cbrt (+ y x)))) x))
       (pow (/ x (+ y x)) (* 0.5 x)))
      x)
     (if (<= y 1.3882841915962162e+254)
       (cbrt (pow (/ (pow (/ x (+ y x)) x) x) 3.0))
       (/
        (*
         (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 VAR;
	if ((y <= -1.1947019381196716e+74)) {
		VAR = ((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 VAR_1;
		if ((y <= 1.9116918545050105e+20)) {
			VAR_1 = (((double) (((double) (((double) (((double) pow(((double) sqrt(((double) fabs((((double) cbrt(x)) / ((double) cbrt(((double) (y + x))))))))), x)) * ((double) pow(((double) sqrt(((double) fabs((((double) cbrt(x)) / ((double) cbrt(((double) (y + x))))))))), x)))) * ((double) pow(((double) sqrt((((double) cbrt(x)) / ((double) cbrt(((double) (y + x))))))), x)))) * ((double) pow((x / ((double) (y + x))), ((double) (0.5 * x)))))) / x);
		} else {
			double VAR_2;
			if ((y <= 1.3882841915962162e+254)) {
				VAR_2 = ((double) cbrt(((double) pow((((double) pow((x / ((double) (y + x))), x)) / x), 3.0))));
			} else {
				VAR_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);
			}
			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
Target7.7
Herbie5.1
\[\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 < -1.19470193811967162e74

    1. Initial program 37.5

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

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

      \[\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. Simplified0.0

      \[\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 -1.19470193811967162e74 < y < 191169185450501046000

    1. Initial program 2.1

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

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

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

      \[\leadsto \frac{\color{blue}{{\left(\sqrt{\frac{x}{x + y}}\right)}^{x} \cdot {\left(\sqrt{\frac{x}{x + y}}\right)}^{x}}}{x}\]
    6. Using strategy rm
    7. Applied pow1/22.1

      \[\leadsto \frac{{\left(\sqrt{\frac{x}{x + y}}\right)}^{x} \cdot {\color{blue}{\left({\left(\frac{x}{x + y}\right)}^{0.5}\right)}}^{x}}{x}\]
    8. Applied pow-pow2.1

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

      \[\leadsto \frac{{\left(\sqrt{\frac{x}{x + y}}\right)}^{x} \cdot {\left(\frac{x}{x + y}\right)}^{\color{blue}{\left(x \cdot 0.5\right)}}}{x}\]
    10. Using strategy rm
    11. Applied add-cube-cbrt22.4

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

      \[\leadsto \frac{{\left(\sqrt{\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} \cdot {\left(\frac{x}{x + y}\right)}^{\left(x \cdot 0.5\right)}}{x}\]
    13. Applied times-frac2.1

      \[\leadsto \frac{{\left(\sqrt{\color{blue}{\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} \cdot {\left(\frac{x}{x + y}\right)}^{\left(x \cdot 0.5\right)}}{x}\]
    14. Applied sqrt-prod2.1

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

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

      \[\leadsto \frac{\left(\color{blue}{{\left(\left|\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right|\right)}^{x}} \cdot {\left(\sqrt{\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}}\right)}^{x}\right) \cdot {\left(\frac{x}{x + y}\right)}^{\left(x \cdot 0.5\right)}}{x}\]
    17. Using strategy rm
    18. Applied add-sqr-sqrt2.1

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

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

    if 191169185450501046000 < y < 1.3882841915962162e254

    1. Initial program 33.0

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

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

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

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

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

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

    if 1.3882841915962162e254 < y

    1. Initial program 29.3

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.1947019381196716 \cdot 10^{+74}:\\ \;\;\;\;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 1.9116918545050105 \cdot 10^{+20}:\\ \;\;\;\;\frac{\left(\left({\left(\sqrt{\left|\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right|}\right)}^{x} \cdot {\left(\sqrt{\left|\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right|}\right)}^{x}\right) \cdot {\left(\sqrt{\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}}\right)}^{x}\right) \cdot {\left(\frac{x}{y + x}\right)}^{\left(0.5 \cdot x\right)}}{x}\\ \mathbf{elif}\;y \leq 1.3882841915962162 \cdot 10^{+254}:\\ \;\;\;\;\sqrt[3]{{\left(\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\right)}^{3}}\\ \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 2020198 
(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))