Average Error: 11.1 → 0.0
Time: 15.5s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -6825213862164115456:\\ \;\;\;\;\frac{1}{x \cdot e^{y}}\\ \mathbf{elif}\;x \le 19.70965259845290873386147723067551851273:\\ \;\;\;\;\frac{e^{\left(2 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right) \cdot x + x \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}}{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 -6825213862164115456:\\
\;\;\;\;\frac{1}{x \cdot e^{y}}\\

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

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

\end{array}
double f(double x, double y) {
        double r302037 = x;
        double r302038 = y;
        double r302039 = r302037 + r302038;
        double r302040 = r302037 / r302039;
        double r302041 = log(r302040);
        double r302042 = r302037 * r302041;
        double r302043 = exp(r302042);
        double r302044 = r302043 / r302037;
        return r302044;
}

double f(double x, double y) {
        double r302045 = x;
        double r302046 = -6.825213862164115e+18;
        bool r302047 = r302045 <= r302046;
        double r302048 = 1.0;
        double r302049 = y;
        double r302050 = exp(r302049);
        double r302051 = r302045 * r302050;
        double r302052 = r302048 / r302051;
        double r302053 = 19.70965259845291;
        bool r302054 = r302045 <= r302053;
        double r302055 = 2.0;
        double r302056 = cbrt(r302045);
        double r302057 = r302045 + r302049;
        double r302058 = cbrt(r302057);
        double r302059 = r302056 / r302058;
        double r302060 = log(r302059);
        double r302061 = r302055 * r302060;
        double r302062 = r302061 * r302045;
        double r302063 = r302045 * r302060;
        double r302064 = r302062 + r302063;
        double r302065 = exp(r302064);
        double r302066 = r302065 / r302045;
        double r302067 = -r302049;
        double r302068 = exp(r302067);
        double r302069 = r302068 / r302045;
        double r302070 = r302054 ? r302066 : r302069;
        double r302071 = r302047 ? r302052 : r302070;
        return r302071;
}

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
Herbie0.0
\[\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 3 regimes
  2. if x < -6.825213862164115e+18

    1. Initial program 11.9

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

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

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

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

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

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

    if -6.825213862164115e+18 < x < 19.70965259845291

    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.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 add-cube-cbrt11.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-frac11.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-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-lft-in2.3

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

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

    if 19.70965259845291 < x

    1. Initial program 10.2

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

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

      \[\leadsto \color{blue}{\frac{e^{-y}}{x}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

herbie shell --seed 2019350 +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))