Average Error: 10.9 → 0.3
Time: 1.2m
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -9603720562144241244067922519785472:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{elif}\;x \le 6.305809243265488292923253978118289242438 \cdot 10^{-10}:\\ \;\;\;\;\frac{e^{x \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}}{x} \cdot e^{x \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right) + x \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}\\ \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 -9603720562144241244067922519785472:\\
\;\;\;\;\frac{e^{-y}}{x}\\

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

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

\end{array}
double f(double x, double y) {
        double r13002513 = x;
        double r13002514 = y;
        double r13002515 = r13002513 + r13002514;
        double r13002516 = r13002513 / r13002515;
        double r13002517 = log(r13002516);
        double r13002518 = r13002513 * r13002517;
        double r13002519 = exp(r13002518);
        double r13002520 = r13002519 / r13002513;
        return r13002520;
}

double f(double x, double y) {
        double r13002521 = x;
        double r13002522 = -9.603720562144241e+33;
        bool r13002523 = r13002521 <= r13002522;
        double r13002524 = y;
        double r13002525 = -r13002524;
        double r13002526 = exp(r13002525);
        double r13002527 = r13002526 / r13002521;
        double r13002528 = 6.305809243265488e-10;
        bool r13002529 = r13002521 <= r13002528;
        double r13002530 = cbrt(r13002521);
        double r13002531 = r13002524 + r13002521;
        double r13002532 = cbrt(r13002531);
        double r13002533 = r13002530 / r13002532;
        double r13002534 = log(r13002533);
        double r13002535 = r13002521 * r13002534;
        double r13002536 = exp(r13002535);
        double r13002537 = r13002536 / r13002521;
        double r13002538 = r13002535 + r13002535;
        double r13002539 = exp(r13002538);
        double r13002540 = r13002537 * r13002539;
        double r13002541 = r13002529 ? r13002540 : r13002527;
        double r13002542 = r13002523 ? r13002527 : r13002541;
        return r13002542;
}

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.8
Herbie0.3
\[\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 < -9.603720562144241e+33 or 6.305809243265488e-10 < x

    1. Initial program 11.4

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

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

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

    if -9.603720562144241e+33 < x < 6.305809243265488e-10

    1. Initial program 10.4

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity10.4

      \[\leadsto \frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{\color{blue}{1 \cdot x}}\]
    4. Applied add-cube-cbrt12.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)}}{1 \cdot x}\]
    5. Applied add-cube-cbrt10.4

      \[\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)}}{1 \cdot x}\]
    6. Applied times-frac10.4

      \[\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)}}}{1 \cdot x}\]
    7. Applied log-prod1.9

      \[\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)}}}{1 \cdot x}\]
    8. Applied distribute-lft-in1.9

      \[\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)}}}{1 \cdot x}\]
    9. Applied exp-sum1.9

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

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

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

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

Reproduce

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