Average Error: 11.6 → 0.2
Time: 26.8s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -338166549708266081878016:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{elif}\;x \le 5.105764663642184685065153471050791722519 \cdot 10^{-5}:\\ \;\;\;\;\frac{e^{x \cdot \left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{\frac{x}{e^{x \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\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 -338166549708266081878016:\\
\;\;\;\;\frac{e^{-y}}{x}\\

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

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

\end{array}
double f(double x, double y) {
        double r25902462 = x;
        double r25902463 = y;
        double r25902464 = r25902462 + r25902463;
        double r25902465 = r25902462 / r25902464;
        double r25902466 = log(r25902465);
        double r25902467 = r25902462 * r25902466;
        double r25902468 = exp(r25902467);
        double r25902469 = r25902468 / r25902462;
        return r25902469;
}

double f(double x, double y) {
        double r25902470 = x;
        double r25902471 = -3.381665497082661e+23;
        bool r25902472 = r25902470 <= r25902471;
        double r25902473 = y;
        double r25902474 = -r25902473;
        double r25902475 = exp(r25902474);
        double r25902476 = r25902475 / r25902470;
        double r25902477 = 5.105764663642185e-05;
        bool r25902478 = r25902470 <= r25902477;
        double r25902479 = cbrt(r25902470);
        double r25902480 = r25902470 + r25902473;
        double r25902481 = cbrt(r25902480);
        double r25902482 = r25902479 / r25902481;
        double r25902483 = log(r25902482);
        double r25902484 = r25902483 + r25902483;
        double r25902485 = r25902470 * r25902484;
        double r25902486 = exp(r25902485);
        double r25902487 = r25902470 * r25902483;
        double r25902488 = exp(r25902487);
        double r25902489 = r25902470 / r25902488;
        double r25902490 = r25902486 / r25902489;
        double r25902491 = r25902478 ? r25902490 : r25902476;
        double r25902492 = r25902472 ? r25902476 : r25902491;
        return r25902492;
}

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.6
Target8.2
Herbie0.2
\[\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 < -3.381665497082661e+23 or 5.105764663642185e-05 < x

    1. Initial program 11.6

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

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

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

    if -3.381665497082661e+23 < x < 5.105764663642185e-05

    1. Initial program 11.6

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

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

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

      \[\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. Applied exp-sum2.3

      \[\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)}}}{x}\]
    9. Applied associate-/l*2.3

      \[\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)}}{\frac{x}{e^{x \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}}}}\]
    10. Using strategy rm
    11. Applied times-frac2.3

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

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

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

Reproduce

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