Average Error: 10.9 → 0.7
Time: 5.8s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.5696397542027947 \cdot 10^{112} \lor \neg \left(x \le 5.2765314246890564 \cdot 10^{-14}\right):\\ \;\;\;\;\frac{e^{-1 \cdot 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 -1.5696397542027947 \cdot 10^{112} \lor \neg \left(x \le 5.2765314246890564 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{e^{-1 \cdot 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 r390902 = x;
        double r390903 = y;
        double r390904 = r390902 + r390903;
        double r390905 = r390902 / r390904;
        double r390906 = log(r390905);
        double r390907 = r390902 * r390906;
        double r390908 = exp(r390907);
        double r390909 = r390908 / r390902;
        return r390909;
}

double f(double x, double y) {
        double r390910 = x;
        double r390911 = -1.5696397542027947e+112;
        bool r390912 = r390910 <= r390911;
        double r390913 = 5.2765314246890564e-14;
        bool r390914 = r390910 <= r390913;
        double r390915 = !r390914;
        bool r390916 = r390912 || r390915;
        double r390917 = -1.0;
        double r390918 = y;
        double r390919 = r390917 * r390918;
        double r390920 = exp(r390919);
        double r390921 = r390920 / r390910;
        double r390922 = exp(r390910);
        double r390923 = r390910 + r390918;
        double r390924 = r390910 / r390923;
        double r390925 = log(r390924);
        double r390926 = pow(r390922, r390925);
        double r390927 = r390926 / r390910;
        double r390928 = r390916 ? r390921 : r390927;
        return r390928;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.9
Target7.7
Herbie0.7
\[\begin{array}{l} \mathbf{if}\;y \lt -3.73118442066479561 \cdot 10^{94}:\\ \;\;\;\;\frac{e^{\frac{-1}{y}}}{x}\\ \mathbf{elif}\;y \lt 2.81795924272828789 \cdot 10^{37}:\\ \;\;\;\;\frac{{\left(\frac{x}{y + x}\right)}^{x}}{x}\\ \mathbf{elif}\;y \lt 2.347387415166998 \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.5696397542027947e+112 or 5.2765314246890564e-14 < x

    1. Initial program 11.3

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

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

    if -1.5696397542027947e+112 < x < 5.2765314246890564e-14

    1. Initial program 10.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.5696397542027947 \cdot 10^{112} \lor \neg \left(x \le 5.2765314246890564 \cdot 10^{-14}\right):\\ \;\;\;\;\frac{e^{-1 \cdot 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 2020062 
(FPCore (x y)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, F"
  :precision binary64

  :herbie-target
  (if (< y -3.7311844206647956e+94) (/ (exp (/ -1 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 y)) x))))

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