Average Error: 11.0 → 0.1
Time: 7.6s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.9722026627658497 \cdot 10^{40}:\\ \;\;\;\;\frac{e^{-1 \cdot y}}{x}\\ \mathbf{elif}\;x \le 0.0031732446158843622:\\ \;\;\;\;\frac{\left({\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x} \cdot {\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}\right) \cdot {\left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)}^{x}}{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 -3.9722026627658497 \cdot 10^{40}:\\
\;\;\;\;\frac{e^{-1 \cdot y}}{x}\\

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

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

\end{array}
double f(double x, double y) {
        double r411121 = x;
        double r411122 = y;
        double r411123 = r411121 + r411122;
        double r411124 = r411121 / r411123;
        double r411125 = log(r411124);
        double r411126 = r411121 * r411125;
        double r411127 = exp(r411126);
        double r411128 = r411127 / r411121;
        return r411128;
}

double f(double x, double y) {
        double r411129 = x;
        double r411130 = -3.9722026627658497e+40;
        bool r411131 = r411129 <= r411130;
        double r411132 = -1.0;
        double r411133 = y;
        double r411134 = r411132 * r411133;
        double r411135 = exp(r411134);
        double r411136 = r411135 / r411129;
        double r411137 = 0.003173244615884362;
        bool r411138 = r411129 <= r411137;
        double r411139 = cbrt(r411129);
        double r411140 = r411129 + r411133;
        double r411141 = cbrt(r411140);
        double r411142 = r411139 / r411141;
        double r411143 = pow(r411142, r411129);
        double r411144 = r411143 * r411143;
        double r411145 = r411144 * r411143;
        double r411146 = r411145 / r411129;
        double r411147 = 1.0;
        double r411148 = exp(r411133);
        double r411149 = r411129 * r411148;
        double r411150 = r411147 / r411149;
        double r411151 = r411138 ? r411146 : r411150;
        double r411152 = r411131 ? r411136 : r411151;
        return r411152;
}

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.0
Target8.2
Herbie0.1
\[\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 < -3.9722026627658497e+40

    1. Initial program 13.6

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Simplified13.6

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

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

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

    if -3.9722026627658497e+40 < x < 0.003173244615884362

    1. Initial program 10.8

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Simplified10.8

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

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

      \[\leadsto \frac{{\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}}{x}\]
    6. Applied times-frac10.8

      \[\leadsto \frac{{\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}}{x}\]
    7. Applied unpow-prod-down2.3

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

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

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

    if 0.003173244615884362 < x

    1. Initial program 9.6

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Simplified9.6

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

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

      \[\leadsto \frac{\color{blue}{e^{-1 \cdot y}}}{x}\]
    5. Using strategy rm
    6. Applied clear-num0.2

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

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

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

Reproduce

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