Average Error: 10.9 → 1.4
Time: 7.8s
Precision: binary64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -9.58411435489314 \lor \neg \left(x \leq 6.240856440186883\right):\\ \;\;\;\;\frac{1}{x \cdot e^{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{1}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right)}^{x} \cdot {\left(\frac{x}{\sqrt[3]{x + y}}\right)}^{x}}{x}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \leq -9.58411435489314 \lor \neg \left(x \leq 6.240856440186883\right):\\
\;\;\;\;\frac{1}{x \cdot e^{y}}\\

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

\end{array}
(FPCore (x y) :precision binary64 (/ (exp (* x (log (/ x (+ x y))))) x))
(FPCore (x y)
 :precision binary64
 (if (or (<= x -9.58411435489314) (not (<= x 6.240856440186883)))
   (/ 1.0 (* x (exp y)))
   (/
    (*
     (pow (/ 1.0 (* (cbrt (+ x y)) (cbrt (+ x y)))) x)
     (pow (/ x (cbrt (+ x y))) x))
    x)))
double code(double x, double y) {
	return exp(x * log(x / (x + y))) / x;
}
double code(double x, double y) {
	double tmp;
	if ((x <= -9.58411435489314) || !(x <= 6.240856440186883)) {
		tmp = 1.0 / (x * exp(y));
	} else {
		tmp = (pow((1.0 / (cbrt(x + y) * cbrt(x + y))), x) * pow((x / cbrt(x + y)), x)) / x;
	}
	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.8
Herbie1.4
\[\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 2 regimes
  2. if x < -9.58423 or 6.24084 < x

    1. Initial program 10.9

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

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

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

      \[\leadsto \color{blue}{e^{-y}} \cdot \frac{1}{x}\]
    6. Using strategy rm
    7. Applied neg-sub0_binary64_44320.0

      \[\leadsto e^{\color{blue}{0 - y}} \cdot \frac{1}{x}\]
    8. Applied exp-diff_binary64_43870.0

      \[\leadsto \color{blue}{\frac{e^{0}}{e^{y}}} \cdot \frac{1}{x}\]
    9. Applied frac-times_binary64_44180.0

      \[\leadsto \color{blue}{\frac{e^{0} \cdot 1}{e^{y} \cdot x}}\]
    10. Simplified0.0

      \[\leadsto \frac{\color{blue}{1}}{e^{y} \cdot x}\]
    11. Simplified0.0

      \[\leadsto \frac{1}{\color{blue}{x \cdot e^{y}}}\]

    if -9.58423 < x < 6.24084

    1. Initial program 10.9

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

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

      \[\leadsto \frac{{\left(\frac{x}{\color{blue}{\left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right) \cdot \sqrt[3]{x + y}}}\right)}^{x}}{x}\]
    5. Applied *-un-lft-identity_binary64_442610.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.58411435489314 \lor \neg \left(x \leq 6.240856440186883\right):\\ \;\;\;\;\frac{1}{x \cdot e^{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{1}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right)}^{x} \cdot {\left(\frac{x}{\sqrt[3]{x + y}}\right)}^{x}}{x}\\ \end{array}\]

Reproduce

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