Average Error: 11.3 → 4.9
Time: 6.5s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;y \le 167.998095920773977:\\ \;\;\;\;\frac{e^{x \cdot \left(2 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{x}\\ \mathbf{elif}\;y \le 1.41249639531232003 \cdot 10^{87}:\\ \;\;\;\;\frac{e^{x \cdot \log \left(\frac{1}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}} \cdot \frac{x}{\sqrt[3]{x + y}}\right)}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot \left(2 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{x}\right)\right)}{\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}\;y \le 167.998095920773977:\\
\;\;\;\;\frac{e^{x \cdot \left(2 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{x}\\

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

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

\end{array}
double f(double x, double y) {
        double r394889 = x;
        double r394890 = y;
        double r394891 = r394889 + r394890;
        double r394892 = r394889 / r394891;
        double r394893 = log(r394892);
        double r394894 = r394889 * r394893;
        double r394895 = exp(r394894);
        double r394896 = r394895 / r394889;
        return r394896;
}

double f(double x, double y) {
        double r394897 = y;
        double r394898 = 167.99809592077398;
        bool r394899 = r394897 <= r394898;
        double r394900 = x;
        double r394901 = 2.0;
        double r394902 = cbrt(r394900);
        double r394903 = r394900 + r394897;
        double r394904 = cbrt(r394903);
        double r394905 = r394902 / r394904;
        double r394906 = log(r394905);
        double r394907 = r394901 * r394906;
        double r394908 = r394907 + r394906;
        double r394909 = r394900 * r394908;
        double r394910 = exp(r394909);
        double r394911 = r394910 / r394900;
        double r394912 = 1.41249639531232e+87;
        bool r394913 = r394897 <= r394912;
        double r394914 = 1.0;
        double r394915 = r394904 * r394904;
        double r394916 = r394914 / r394915;
        double r394917 = r394900 / r394904;
        double r394918 = r394916 * r394917;
        double r394919 = log(r394918);
        double r394920 = r394900 * r394919;
        double r394921 = exp(r394920);
        double r394922 = r394921 / r394900;
        double r394923 = log1p(r394902);
        double r394924 = expm1(r394923);
        double r394925 = r394924 / r394904;
        double r394926 = log(r394925);
        double r394927 = r394907 + r394926;
        double r394928 = r394900 * r394927;
        double r394929 = exp(r394928);
        double r394930 = r394929 / r394900;
        double r394931 = r394913 ? r394922 : r394930;
        double r394932 = r394899 ? r394911 : r394931;
        return r394932;
}

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.3
Target8.4
Herbie4.9
\[\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 3 regimes
  2. if y < 167.99809592077398

    1. Initial program 4.5

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

      \[\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-cbrt4.5

      \[\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-frac4.5

      \[\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-prod1.6

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

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

    if 167.99809592077398 < y < 1.41249639531232e+87

    1. Initial program 37.3

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

      \[\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-identity24.8

      \[\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-frac25.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}\]

    if 1.41249639531232e+87 < y

    1. Initial program 30.1

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

      \[\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-cbrt30.2

      \[\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-frac30.2

      \[\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-prod17.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. Simplified14.4

      \[\leadsto \frac{e^{x \cdot \left(\color{blue}{2 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)} + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{x}\]
    8. Using strategy rm
    9. Applied expm1-log1p-u13.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 167.998095920773977:\\ \;\;\;\;\frac{e^{x \cdot \left(2 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{x}\\ \mathbf{elif}\;y \le 1.41249639531232003 \cdot 10^{87}:\\ \;\;\;\;\frac{e^{x \cdot \log \left(\frac{1}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}} \cdot \frac{x}{\sqrt[3]{x + y}}\right)}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot \left(2 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{x}\right)\right)}{\sqrt[3]{x + y}}\right)\right)}}{x}\\ \end{array}\]

Reproduce

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