Average Error: 11.1 → 1.6
Time: 16.8s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.779773110456055906780648001586087048054 \lor \neg \left(x \le 1.553239629750104566379326253081072373163 \cdot 10^{-7}\right):\\ \;\;\;\;\frac{1}{x \cdot e^{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{1}{\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}}\right)}^{x} \cdot {\left(\frac{x}{\sqrt[3]{y + x}}\right)}^{x}}{x}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \le -2.779773110456055906780648001586087048054 \lor \neg \left(x \le 1.553239629750104566379326253081072373163 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{1}{x \cdot e^{y}}\\

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

\end{array}
double f(double x, double y) {
        double r321900 = x;
        double r321901 = y;
        double r321902 = r321900 + r321901;
        double r321903 = r321900 / r321902;
        double r321904 = log(r321903);
        double r321905 = r321900 * r321904;
        double r321906 = exp(r321905);
        double r321907 = r321906 / r321900;
        return r321907;
}

double f(double x, double y) {
        double r321908 = x;
        double r321909 = -2.779773110456056;
        bool r321910 = r321908 <= r321909;
        double r321911 = 1.5532396297501046e-07;
        bool r321912 = r321908 <= r321911;
        double r321913 = !r321912;
        bool r321914 = r321910 || r321913;
        double r321915 = 1.0;
        double r321916 = y;
        double r321917 = exp(r321916);
        double r321918 = r321908 * r321917;
        double r321919 = r321915 / r321918;
        double r321920 = r321916 + r321908;
        double r321921 = cbrt(r321920);
        double r321922 = r321921 * r321921;
        double r321923 = r321915 / r321922;
        double r321924 = pow(r321923, r321908);
        double r321925 = r321908 / r321921;
        double r321926 = pow(r321925, r321908);
        double r321927 = r321924 * r321926;
        double r321928 = r321927 / r321908;
        double r321929 = r321914 ? r321919 : r321928;
        return r321929;
}

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.5
Herbie1.6
\[\begin{array}{l} \mathbf{if}\;y \lt -3.73118442066479561492798134439269393419 \cdot 10^{94}:\\ \;\;\;\;\frac{e^{\frac{-1}{y}}}{x}\\ \mathbf{elif}\;y \lt 28179592427282878868860376020282245120:\\ \;\;\;\;\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\\ \mathbf{elif}\;y \lt 2.347387415166997963747840232163110922613 \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 < -2.779773110456056 or 1.5532396297501046e-07 < x

    1. Initial program 10.8

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

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

      \[\leadsto \frac{\color{blue}{e^{-y}}}{x}\]
    4. Using strategy rm
    5. Applied neg-sub00.4

      \[\leadsto \frac{e^{\color{blue}{0 - y}}}{x}\]
    6. Applied exp-diff0.4

      \[\leadsto \frac{\color{blue}{\frac{e^{0}}{e^{y}}}}{x}\]
    7. Applied associate-/l/0.4

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

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

    if -2.779773110456056 < x < 1.5532396297501046e-07

    1. Initial program 11.4

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019195 
(FPCore (x y)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, F"

  :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))