Average Error: 11.6 → 0.2
Time: 21.9s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -338166549708266081878016:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{elif}\;x \le 5.105764663642184685065153471050791722519 \cdot 10^{-5}:\\ \;\;\;\;\frac{e^{x \cdot \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)\right)}}{\frac{x}{e^{\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right) \cdot x}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \le -338166549708266081878016:\\
\;\;\;\;\frac{e^{-y}}{x}\\

\mathbf{elif}\;x \le 5.105764663642184685065153471050791722519 \cdot 10^{-5}:\\
\;\;\;\;\frac{e^{x \cdot \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)\right)}}{\frac{x}{e^{\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right) \cdot x}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{e^{-y}}{x}\\

\end{array}
double f(double x, double y) {
        double r17220915 = x;
        double r17220916 = y;
        double r17220917 = r17220915 + r17220916;
        double r17220918 = r17220915 / r17220917;
        double r17220919 = log(r17220918);
        double r17220920 = r17220915 * r17220919;
        double r17220921 = exp(r17220920);
        double r17220922 = r17220921 / r17220915;
        return r17220922;
}

double f(double x, double y) {
        double r17220923 = x;
        double r17220924 = -3.381665497082661e+23;
        bool r17220925 = r17220923 <= r17220924;
        double r17220926 = y;
        double r17220927 = -r17220926;
        double r17220928 = exp(r17220927);
        double r17220929 = r17220928 / r17220923;
        double r17220930 = 5.105764663642185e-05;
        bool r17220931 = r17220923 <= r17220930;
        double r17220932 = cbrt(r17220923);
        double r17220933 = r17220926 + r17220923;
        double r17220934 = cbrt(r17220933);
        double r17220935 = r17220932 / r17220934;
        double r17220936 = log(r17220935);
        double r17220937 = r17220936 + r17220936;
        double r17220938 = r17220923 * r17220937;
        double r17220939 = exp(r17220938);
        double r17220940 = r17220936 * r17220923;
        double r17220941 = exp(r17220940);
        double r17220942 = r17220923 / r17220941;
        double r17220943 = r17220939 / r17220942;
        double r17220944 = r17220931 ? r17220943 : r17220929;
        double r17220945 = r17220925 ? r17220929 : r17220944;
        return r17220945;
}

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.6
Target8.2
Herbie0.2
\[\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 < -3.381665497082661e+23 or 5.105764663642185e-05 < x

    1. Initial program 11.6

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Taylor expanded around inf 0.3

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

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

    if -3.381665497082661e+23 < x < 5.105764663642185e-05

    1. Initial program 11.6

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt12.4

      \[\leadsto \frac{e^{x \cdot \log \left(\frac{x}{\color{blue}{\left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right) \cdot \sqrt[3]{x + y}}}\right)}}{x}\]
    4. Applied add-cube-cbrt11.6

      \[\leadsto \frac{e^{x \cdot \log \left(\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}\]
    5. Applied times-frac11.6

      \[\leadsto \frac{e^{x \cdot \log \color{blue}{\left(\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}\]
    6. Applied log-prod2.3

      \[\leadsto \frac{e^{x \cdot \color{blue}{\left(\log \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}}{x}\]
    7. Applied distribute-rgt-in2.3

      \[\leadsto \frac{e^{\color{blue}{\log \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right) \cdot x + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) \cdot x}}}{x}\]
    8. Applied exp-sum2.3

      \[\leadsto \frac{\color{blue}{e^{\log \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right) \cdot x} \cdot e^{\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) \cdot x}}}{x}\]
    9. Applied associate-/l*2.3

      \[\leadsto \color{blue}{\frac{e^{\log \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right) \cdot x}}{\frac{x}{e^{\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) \cdot x}}}}\]
    10. Using strategy rm
    11. Applied times-frac2.3

      \[\leadsto \frac{e^{\log \color{blue}{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)} \cdot x}}{\frac{x}{e^{\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) \cdot x}}}\]
    12. Applied log-prod0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -338166549708266081878016:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{elif}\;x \le 5.105764663642184685065153471050791722519 \cdot 10^{-5}:\\ \;\;\;\;\frac{e^{x \cdot \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)\right)}}{\frac{x}{e^{\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right) \cdot x}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(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))