Average Error: 11.6 → 0.2
Time: 20.3s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -338166549708266081878016 \lor \neg \left(x \le 5.105764663642184685065153471050791722519 \cdot 10^{-5}\right):\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}^{x} \cdot {\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}^{x}}{\frac{x}{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}^{x}}}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \le -338166549708266081878016 \lor \neg \left(x \le 5.105764663642184685065153471050791722519 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{e^{-y}}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}^{x} \cdot {\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}^{x}}{\frac{x}{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}^{x}}}\\

\end{array}
double f(double x, double y) {
        double r270185 = x;
        double r270186 = y;
        double r270187 = r270185 + r270186;
        double r270188 = r270185 / r270187;
        double r270189 = log(r270188);
        double r270190 = r270185 * r270189;
        double r270191 = exp(r270190);
        double r270192 = r270191 / r270185;
        return r270192;
}

double f(double x, double y) {
        double r270193 = x;
        double r270194 = -3.381665497082661e+23;
        bool r270195 = r270193 <= r270194;
        double r270196 = 5.105764663642185e-05;
        bool r270197 = r270193 <= r270196;
        double r270198 = !r270197;
        bool r270199 = r270195 || r270198;
        double r270200 = y;
        double r270201 = -r270200;
        double r270202 = exp(r270201);
        double r270203 = r270202 / r270193;
        double r270204 = cbrt(r270193);
        double r270205 = r270200 + r270193;
        double r270206 = cbrt(r270205);
        double r270207 = r270204 / r270206;
        double r270208 = pow(r270207, r270193);
        double r270209 = r270208 * r270208;
        double r270210 = r270193 / r270208;
        double r270211 = r270209 / r270210;
        double r270212 = r270199 ? r270203 : r270211;
        return r270212;
}

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. Simplified11.6

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\]
    3. Taylor expanded around inf 0.3

      \[\leadsto \frac{\color{blue}{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. Simplified11.6

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt12.4

      \[\leadsto \frac{{\left(\frac{x}{\color{blue}{\left(\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}\right) \cdot \sqrt[3]{y + x}}}\right)}^{x}}{x}\]
    5. Applied add-cube-cbrt11.6

      \[\leadsto \frac{{\left(\frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\left(\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}\right) \cdot \sqrt[3]{y + x}}\right)}^{x}}{x}\]
    6. Applied times-frac11.6

      \[\leadsto \frac{{\color{blue}{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}}^{x}}{x}\]
    7. Applied unpow-prod-down2.3

      \[\leadsto \frac{\color{blue}{{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}}\right)}^{x} \cdot {\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}^{x}}}{x}\]
    8. Applied associate-/l*2.3

      \[\leadsto \color{blue}{\frac{{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}}\right)}^{x}}{\frac{x}{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}^{x}}}}\]
    9. Simplified2.3

      \[\leadsto \frac{{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{y + x} \cdot \sqrt[3]{y + x}}\right)}^{x}}{\color{blue}{\frac{x}{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}}}\]
    10. Using strategy rm
    11. Applied times-frac2.3

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -338166549708266081878016 \lor \neg \left(x \le 5.105764663642184685065153471050791722519 \cdot 10^{-5}\right):\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}^{x} \cdot {\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}^{x}}{\frac{x}{{\left(\frac{\sqrt[3]{x}}{\sqrt[3]{y + x}}\right)}^{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))