Average Error: 11.4 → 0.5
Time: 26.2s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.825603746180263343792126173792163470345 \cdot 10^{117}:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{elif}\;x \le 5.955847209664487884595018840627744793892:\\ \;\;\;\;\frac{{\left(e^{x}\right)}^{\left(\log \left(\frac{x}{x + y}\right)\right)}}{x}\\ \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 -1.825603746180263343792126173792163470345 \cdot 10^{117}:\\
\;\;\;\;\frac{e^{-y}}{x}\\

\mathbf{elif}\;x \le 5.955847209664487884595018840627744793892:\\
\;\;\;\;\frac{{\left(e^{x}\right)}^{\left(\log \left(\frac{x}{x + y}\right)\right)}}{x}\\

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

\end{array}
double f(double x, double y) {
        double r84400827 = x;
        double r84400828 = y;
        double r84400829 = r84400827 + r84400828;
        double r84400830 = r84400827 / r84400829;
        double r84400831 = log(r84400830);
        double r84400832 = r84400827 * r84400831;
        double r84400833 = exp(r84400832);
        double r84400834 = r84400833 / r84400827;
        return r84400834;
}

double f(double x, double y) {
        double r84400835 = x;
        double r84400836 = -1.8256037461802633e+117;
        bool r84400837 = r84400835 <= r84400836;
        double r84400838 = y;
        double r84400839 = -r84400838;
        double r84400840 = exp(r84400839);
        double r84400841 = r84400840 / r84400835;
        double r84400842 = 5.955847209664488;
        bool r84400843 = r84400835 <= r84400842;
        double r84400844 = exp(r84400835);
        double r84400845 = r84400835 + r84400838;
        double r84400846 = r84400835 / r84400845;
        double r84400847 = log(r84400846);
        double r84400848 = pow(r84400844, r84400847);
        double r84400849 = r84400848 / r84400835;
        double r84400850 = r84400843 ? r84400849 : r84400841;
        double r84400851 = r84400837 ? r84400841 : r84400850;
        return r84400851;
}

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.4
Target7.8
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 2 regimes
  2. if x < -1.8256037461802633e+117 or 5.955847209664488 < x

    1. Initial program 11.7

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

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

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

    if -1.8256037461802633e+117 < x < 5.955847209664488

    1. Initial program 11.1

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

      \[\leadsto \frac{e^{\color{blue}{\log \left(e^{x}\right)} \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    4. Applied exp-to-pow0.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.825603746180263343792126173792163470345 \cdot 10^{117}:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{elif}\;x \le 5.955847209664487884595018840627744793892:\\ \;\;\;\;\frac{{\left(e^{x}\right)}^{\left(\log \left(\frac{x}{x + y}\right)\right)}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \end{array}\]

Reproduce

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