Average Error: 11.1 → 0.4
Time: 21.5s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.120156288663160099262452246870941235987 \cdot 10^{50} \lor \neg \left(x \le 1.115898472191414701666743120923343257633 \cdot 10^{-9}\right):\\ \;\;\;\;\frac{1}{e^{y} \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot \left(2 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{x}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \le -4.120156288663160099262452246870941235987 \cdot 10^{50} \lor \neg \left(x \le 1.115898472191414701666743120923343257633 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{1}{e^{y} \cdot x}\\

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

\end{array}
double f(double x, double y) {
        double r973176 = x;
        double r973177 = y;
        double r973178 = r973176 + r973177;
        double r973179 = r973176 / r973178;
        double r973180 = log(r973179);
        double r973181 = r973176 * r973180;
        double r973182 = exp(r973181);
        double r973183 = r973182 / r973176;
        return r973183;
}

double f(double x, double y) {
        double r973184 = x;
        double r973185 = -4.12015628866316e+50;
        bool r973186 = r973184 <= r973185;
        double r973187 = 1.1158984721914147e-09;
        bool r973188 = r973184 <= r973187;
        double r973189 = !r973188;
        bool r973190 = r973186 || r973189;
        double r973191 = 1.0;
        double r973192 = y;
        double r973193 = exp(r973192);
        double r973194 = r973193 * r973184;
        double r973195 = r973191 / r973194;
        double r973196 = 2.0;
        double r973197 = cbrt(r973184);
        double r973198 = r973184 + r973192;
        double r973199 = cbrt(r973198);
        double r973200 = r973197 / r973199;
        double r973201 = log(r973200);
        double r973202 = r973196 * r973201;
        double r973203 = r973202 + r973201;
        double r973204 = r973184 * r973203;
        double r973205 = exp(r973204);
        double r973206 = r973205 / r973184;
        double r973207 = r973190 ? r973195 : r973206;
        return r973207;
}

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.1
Target8.0
Herbie0.4
\[\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 < -4.12015628866316e+50 or 1.1158984721914147e-09 < x

    1. Initial program 11.7

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

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

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

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

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

    if -4.12015628866316e+50 < x < 1.1158984721914147e-09

    1. Initial program 10.6

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

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

      \[\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. Simplified0.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.120156288663160099262452246870941235987 \cdot 10^{50} \lor \neg \left(x \le 1.115898472191414701666743120923343257633 \cdot 10^{-9}\right):\\ \;\;\;\;\frac{1}{e^{y} \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot \left(2 \cdot \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{x}\\ \end{array}\]

Reproduce

herbie shell --seed 2019303 
(FPCore (x y)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, F"
  :precision binary64

  :herbie-target
  (if (< y -3.73118442066479561e94) (/ (exp (/ -1 y)) x) (if (< y 2.81795924272828789e37) (/ (pow (/ x (+ y x)) x) x) (if (< y 2.347387415166998e178) (log (exp (/ (pow (/ x (+ y x)) x) x))) (/ (exp (/ -1 y)) x))))

  (/ (exp (* x (log (/ x (+ x y))))) x))