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

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

\end{array}
double f(double x, double y) {
        double r394879 = x;
        double r394880 = y;
        double r394881 = r394879 + r394880;
        double r394882 = r394879 / r394881;
        double r394883 = log(r394882);
        double r394884 = r394879 * r394883;
        double r394885 = exp(r394884);
        double r394886 = r394885 / r394879;
        return r394886;
}

double f(double x, double y) {
        double r394887 = x;
        double r394888 = -0.04316903427145046;
        bool r394889 = r394887 <= r394888;
        double r394890 = 0.001181958732382718;
        bool r394891 = r394887 <= r394890;
        double r394892 = !r394891;
        bool r394893 = r394889 || r394892;
        double r394894 = -1.0;
        double r394895 = y;
        double r394896 = r394894 * r394895;
        double r394897 = exp(r394896);
        double r394898 = r394897 / r394887;
        double r394899 = 1.0;
        double r394900 = r394887 + r394895;
        double r394901 = cbrt(r394900);
        double r394902 = r394901 * r394901;
        double r394903 = r394899 / r394902;
        double r394904 = log(r394903);
        double r394905 = r394887 / r394901;
        double r394906 = log(r394905);
        double r394907 = r394904 + r394906;
        double r394908 = r394887 * r394907;
        double r394909 = exp(r394908);
        double r394910 = r394909 / r394887;
        double r394911 = r394893 ? r394898 : r394910;
        return r394911;
}

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.4
Target8.5
Herbie1.6
\[\begin{array}{l} \mathbf{if}\;y \lt -3.73118442066479561 \cdot 10^{94}:\\ \;\;\;\;\frac{e^{\frac{-1}{y}}}{x}\\ \mathbf{elif}\;y \lt 2.81795924272828789 \cdot 10^{37}:\\ \;\;\;\;\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\\ \mathbf{elif}\;y \lt 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 < -0.04316903427145046 or 0.001181958732382718 < x

    1. Initial program 11.5

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

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

    if -0.04316903427145046 < x < 0.001181958732382718

    1. Initial program 11.2

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

      \[\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 *-un-lft-identity11.2

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

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

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

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

Reproduce

herbie shell --seed 2020034 
(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 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 y)) x))))

  (/ (exp (* x (log (/ x (+ x y))))) x))