Average Error: 11.1 → 0.3
Time: 19.9s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -27740047836885.015625 \lor \neg \left(x \le 2.342700812230118325560812748975525465767 \cdot 10^{-7}\right):\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(e^{x}\right)}^{\left(\log \left(\frac{x}{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 -27740047836885.015625 \lor \neg \left(x \le 2.342700812230118325560812748975525465767 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{e^{-y}}{x}\\

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

\end{array}
double f(double x, double y) {
        double r258226 = x;
        double r258227 = y;
        double r258228 = r258226 + r258227;
        double r258229 = r258226 / r258228;
        double r258230 = log(r258229);
        double r258231 = r258226 * r258230;
        double r258232 = exp(r258231);
        double r258233 = r258232 / r258226;
        return r258233;
}

double f(double x, double y) {
        double r258234 = x;
        double r258235 = -27740047836885.016;
        bool r258236 = r258234 <= r258235;
        double r258237 = 2.3427008122301183e-07;
        bool r258238 = r258234 <= r258237;
        double r258239 = !r258238;
        bool r258240 = r258236 || r258239;
        double r258241 = y;
        double r258242 = -r258241;
        double r258243 = exp(r258242);
        double r258244 = r258243 / r258234;
        double r258245 = exp(r258234);
        double r258246 = r258234 + r258241;
        double r258247 = r258234 / r258246;
        double r258248 = log(r258247);
        double r258249 = pow(r258245, r258248);
        double r258250 = r258249 / r258234;
        double r258251 = r258240 ? r258244 : r258250;
        return r258251;
}

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.3
Herbie0.3
\[\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 < -27740047836885.016 or 2.3427008122301183e-07 < x

    1. Initial program 11.1

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

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

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

    if -27740047836885.016 < x < 2.3427008122301183e-07

    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-exp12.3

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

      \[\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.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -27740047836885.015625 \lor \neg \left(x \le 2.342700812230118325560812748975525465767 \cdot 10^{-7}\right):\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(e^{x}\right)}^{\left(\log \left(\frac{x}{x + y}\right)\right)}}{x}\\ \end{array}\]

Reproduce

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