Average Error: 10.9 → 0.4
Time: 20.3s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -5.12799110664252433 \cdot 10^{64}:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{elif}\;x \le 3.5038509428931215 \cdot 10^{-13}:\\ \;\;\;\;\frac{e^{\left(\log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) - \log \left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right)\right) \cdot x}}{\frac{x}{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot e^{y}}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \le -5.12799110664252433 \cdot 10^{64}:\\
\;\;\;\;\frac{e^{-y}}{x}\\

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

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

\end{array}
double f(double x, double y) {
        double r290417 = x;
        double r290418 = y;
        double r290419 = r290417 + r290418;
        double r290420 = r290417 / r290419;
        double r290421 = log(r290420);
        double r290422 = r290417 * r290421;
        double r290423 = exp(r290422);
        double r290424 = r290423 / r290417;
        return r290424;
}

double f(double x, double y) {
        double r290425 = x;
        double r290426 = -5.1279911066425243e+64;
        bool r290427 = r290425 <= r290426;
        double r290428 = y;
        double r290429 = -r290428;
        double r290430 = exp(r290429);
        double r290431 = r290430 / r290425;
        double r290432 = 3.5038509428931215e-13;
        bool r290433 = r290425 <= r290432;
        double r290434 = cbrt(r290425);
        double r290435 = r290434 * r290434;
        double r290436 = log(r290435);
        double r290437 = r290425 + r290428;
        double r290438 = cbrt(r290437);
        double r290439 = r290438 * r290438;
        double r290440 = log(r290439);
        double r290441 = r290436 - r290440;
        double r290442 = r290441 * r290425;
        double r290443 = exp(r290442);
        double r290444 = r290434 / r290438;
        double r290445 = pow(r290444, r290425);
        double r290446 = r290425 / r290445;
        double r290447 = r290443 / r290446;
        double r290448 = 1.0;
        double r290449 = exp(r290428);
        double r290450 = r290425 * r290449;
        double r290451 = r290448 / r290450;
        double r290452 = r290433 ? r290447 : r290451;
        double r290453 = r290427 ? r290431 : r290452;
        return r290453;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.9
Target7.9
Herbie0.4
\[\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 x < -5.1279911066425243e+64

    1. Initial program 13.6

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

    if -5.1279911066425243e+64 < x < 3.5038509428931215e-13

    1. Initial program 10.7

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt14.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 add-cube-cbrt10.7

      \[\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-frac10.7

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

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

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

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

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

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

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

      \[\leadsto \frac{e^{\log \left(\frac{\color{blue}{e^{\log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}}}{e^{\log \left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right)}}\right) \cdot x}}{\frac{x}{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}}\]
    14. Applied div-exp2.4

      \[\leadsto \frac{e^{\log \color{blue}{\left(e^{\log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) - \log \left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right)}\right)} \cdot x}}{\frac{x}{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}}\]
    15. Applied rem-log-exp0.2

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

    if 3.5038509428931215e-13 < x

    1. Initial program 9.3

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

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

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

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

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

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

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

Reproduce

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