Average Error: 10.9 → 0.7
Time: 6.3s
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}:\\ \;\;\;\;\frac{1}{x \cdot e^{y}}\\ \mathbf{elif}\;x \le 5.2765314246890564 \cdot 10^{-14}:\\ \;\;\;\;\frac{{\left(e^{x}\right)}^{\left(\log \left(\frac{x}{x + y}\right)\right)}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{-1 \cdot y}}{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}:\\
\;\;\;\;\frac{1}{x \cdot e^{y}}\\

\mathbf{elif}\;x \le 5.2765314246890564 \cdot 10^{-14}:\\
\;\;\;\;\frac{{\left(e^{x}\right)}^{\left(\log \left(\frac{x}{x + y}\right)\right)}}{x}\\

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

\end{array}
double f(double x, double y) {
        double r372151 = x;
        double r372152 = y;
        double r372153 = r372151 + r372152;
        double r372154 = r372151 / r372153;
        double r372155 = log(r372154);
        double r372156 = r372151 * r372155;
        double r372157 = exp(r372156);
        double r372158 = r372157 / r372151;
        return r372158;
}

double f(double x, double y) {
        double r372159 = x;
        double r372160 = -1.5696397542027947e+112;
        bool r372161 = r372159 <= r372160;
        double r372162 = 1.0;
        double r372163 = y;
        double r372164 = exp(r372163);
        double r372165 = r372159 * r372164;
        double r372166 = r372162 / r372165;
        double r372167 = 5.2765314246890564e-14;
        bool r372168 = r372159 <= r372167;
        double r372169 = exp(r372159);
        double r372170 = r372159 + r372163;
        double r372171 = r372159 / r372170;
        double r372172 = log(r372171);
        double r372173 = pow(r372169, r372172);
        double r372174 = r372173 / r372159;
        double r372175 = -1.0;
        double r372176 = r372175 * r372163;
        double r372177 = exp(r372176);
        double r372178 = r372177 / r372159;
        double r372179 = r372168 ? r372174 : r372178;
        double r372180 = r372161 ? r372166 : r372179;
        return r372180;
}

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 3 regimes
  2. if x < -1.5696397542027947e+112

    1. Initial program 14.6

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

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

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

    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}\]

    if 5.2765314246890564e-14 < x

    1. Initial program 9.5

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot y}}{x}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.5696397542027947 \cdot 10^{112}:\\ \;\;\;\;\frac{1}{x \cdot e^{y}}\\ \mathbf{elif}\;x \le 5.2765314246890564 \cdot 10^{-14}:\\ \;\;\;\;\frac{{\left(e^{x}\right)}^{\left(\log \left(\frac{x}{x + y}\right)\right)}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{-1 \cdot y}}{x}\\ \end{array}\]

Reproduce

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