Average Error: 11.5 → 0.5
Time: 6.2s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -6855000109145468998274891760271360:\\ \;\;\;\;\sqrt{e^{-1 \cdot y}} \cdot \frac{\sqrt{e^{-1 \cdot y}}}{x}\\ \mathbf{elif}\;x \le 0.5062656618457485047102295538934413343668:\\ \;\;\;\;\frac{e^{x \cdot 0}}{x}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\sqrt{e^{-1 \cdot y}}} \cdot \frac{{\left(\sqrt{\sqrt{e^{-1 \cdot y}}}\right)}^{3}}{x}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \le -6855000109145468998274891760271360:\\
\;\;\;\;\sqrt{e^{-1 \cdot y}} \cdot \frac{\sqrt{e^{-1 \cdot y}}}{x}\\

\mathbf{elif}\;x \le 0.5062656618457485047102295538934413343668:\\
\;\;\;\;\frac{e^{x \cdot 0}}{x}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\sqrt{e^{-1 \cdot y}}} \cdot \frac{{\left(\sqrt{\sqrt{e^{-1 \cdot y}}}\right)}^{3}}{x}\\

\end{array}
double f(double x, double y) {
        double r372776 = x;
        double r372777 = y;
        double r372778 = r372776 + r372777;
        double r372779 = r372776 / r372778;
        double r372780 = log(r372779);
        double r372781 = r372776 * r372780;
        double r372782 = exp(r372781);
        double r372783 = r372782 / r372776;
        return r372783;
}

double f(double x, double y) {
        double r372784 = x;
        double r372785 = -6.855000109145469e+33;
        bool r372786 = r372784 <= r372785;
        double r372787 = -1.0;
        double r372788 = y;
        double r372789 = r372787 * r372788;
        double r372790 = exp(r372789);
        double r372791 = sqrt(r372790);
        double r372792 = r372791 / r372784;
        double r372793 = r372791 * r372792;
        double r372794 = 0.5062656618457485;
        bool r372795 = r372784 <= r372794;
        double r372796 = 0.0;
        double r372797 = r372784 * r372796;
        double r372798 = exp(r372797);
        double r372799 = r372798 / r372784;
        double r372800 = sqrt(r372791);
        double r372801 = 3.0;
        double r372802 = pow(r372800, r372801);
        double r372803 = r372802 / r372784;
        double r372804 = r372800 * r372803;
        double r372805 = r372795 ? r372799 : r372804;
        double r372806 = r372786 ? r372793 : r372805;
        return r372806;
}

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.5
Target8.2
Herbie0.5
\[\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 3 regimes
  2. if x < -6.855000109145469e+33

    1. Initial program 12.4

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot y}}{x}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity0.0

      \[\leadsto \frac{e^{-1 \cdot y}}{\color{blue}{1 \cdot x}}\]
    5. Applied add-sqr-sqrt0.1

      \[\leadsto \frac{\color{blue}{\sqrt{e^{-1 \cdot y}} \cdot \sqrt{e^{-1 \cdot y}}}}{1 \cdot x}\]
    6. Applied times-frac0.1

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

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

    if -6.855000109145469e+33 < x < 0.5062656618457485

    1. Initial program 11.9

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

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

    if 0.5062656618457485 < x

    1. Initial program 10.3

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot y}}{x}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity0.1

      \[\leadsto \frac{e^{-1 \cdot y}}{\color{blue}{1 \cdot x}}\]
    5. Applied add-sqr-sqrt0.1

      \[\leadsto \frac{\color{blue}{\sqrt{e^{-1 \cdot y}} \cdot \sqrt{e^{-1 \cdot y}}}}{1 \cdot x}\]
    6. Applied times-frac0.1

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

      \[\leadsto \color{blue}{\sqrt{e^{-1 \cdot y}}} \cdot \frac{\sqrt{e^{-1 \cdot y}}}{x}\]
    8. Using strategy rm
    9. Applied add-sqr-sqrt0.1

      \[\leadsto \sqrt{\color{blue}{\sqrt{e^{-1 \cdot y}} \cdot \sqrt{e^{-1 \cdot y}}}} \cdot \frac{\sqrt{e^{-1 \cdot y}}}{x}\]
    10. Applied sqrt-prod0.1

      \[\leadsto \color{blue}{\left(\sqrt{\sqrt{e^{-1 \cdot y}}} \cdot \sqrt{\sqrt{e^{-1 \cdot y}}}\right)} \cdot \frac{\sqrt{e^{-1 \cdot y}}}{x}\]
    11. Applied associate-*l*0.1

      \[\leadsto \color{blue}{\sqrt{\sqrt{e^{-1 \cdot y}}} \cdot \left(\sqrt{\sqrt{e^{-1 \cdot y}}} \cdot \frac{\sqrt{e^{-1 \cdot y}}}{x}\right)}\]
    12. Simplified0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -6855000109145468998274891760271360:\\ \;\;\;\;\sqrt{e^{-1 \cdot y}} \cdot \frac{\sqrt{e^{-1 \cdot y}}}{x}\\ \mathbf{elif}\;x \le 0.5062656618457485047102295538934413343668:\\ \;\;\;\;\frac{e^{x \cdot 0}}{x}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\sqrt{e^{-1 \cdot y}}} \cdot \frac{{\left(\sqrt{\sqrt{e^{-1 \cdot y}}}\right)}^{3}}{x}\\ \end{array}\]

Reproduce

herbie shell --seed 2019322 
(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))