Average Error: 11.0 → 0.5
Time: 15.4s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -18649979204356907008:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{elif}\;x \le 0.3987830221801595409480967191484523937106:\\ \;\;\;\;\frac{1}{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 -18649979204356907008:\\
\;\;\;\;\frac{e^{-y}}{x}\\

\mathbf{elif}\;x \le 0.3987830221801595409480967191484523937106:\\
\;\;\;\;\frac{1}{x}\\

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

\end{array}
double f(double x, double y) {
        double r16267692 = x;
        double r16267693 = y;
        double r16267694 = r16267692 + r16267693;
        double r16267695 = r16267692 / r16267694;
        double r16267696 = log(r16267695);
        double r16267697 = r16267692 * r16267696;
        double r16267698 = exp(r16267697);
        double r16267699 = r16267698 / r16267692;
        return r16267699;
}

double f(double x, double y) {
        double r16267700 = x;
        double r16267701 = -1.8649979204356907e+19;
        bool r16267702 = r16267700 <= r16267701;
        double r16267703 = y;
        double r16267704 = -r16267703;
        double r16267705 = exp(r16267704);
        double r16267706 = r16267705 / r16267700;
        double r16267707 = 0.39878302218015954;
        bool r16267708 = r16267700 <= r16267707;
        double r16267709 = 1.0;
        double r16267710 = r16267709 / r16267700;
        double r16267711 = r16267708 ? r16267710 : r16267706;
        double r16267712 = r16267702 ? r16267706 : r16267711;
        return r16267712;
}

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
Target7.9
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.8649979204356907e+19 or 0.39878302218015954 < x

    1. Initial program 11.0

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

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

    if -1.8649979204356907e+19 < x < 0.39878302218015954

    1. Initial program 11.1

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

      \[\leadsto \frac{e^{\color{blue}{0}}}{x}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -18649979204356907008:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{elif}\;x \le 0.3987830221801595409480967191484523937106:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \end{array}\]

Reproduce

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