Average Error: 10.9 → 0.7
Time: 5.9s
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 r418593 = x;
        double r418594 = y;
        double r418595 = r418593 + r418594;
        double r418596 = r418593 / r418595;
        double r418597 = log(r418596);
        double r418598 = r418593 * r418597;
        double r418599 = exp(r418598);
        double r418600 = r418599 / r418593;
        return r418600;
}

double f(double x, double y) {
        double r418601 = x;
        double r418602 = -1.5696397542027947e+112;
        bool r418603 = r418601 <= r418602;
        double r418604 = 5.2765314246890564e-14;
        bool r418605 = r418601 <= r418604;
        double r418606 = !r418605;
        bool r418607 = r418603 || r418606;
        double r418608 = -1.0;
        double r418609 = y;
        double r418610 = r418608 * r418609;
        double r418611 = exp(r418610);
        double r418612 = r418611 / r418601;
        double r418613 = exp(r418601);
        double r418614 = r418601 + r418609;
        double r418615 = r418601 / r418614;
        double r418616 = log(r418615);
        double r418617 = pow(r418613, r418616);
        double r418618 = r418617 / r418601;
        double r418619 = r418607 ? r418612 : r418618;
        return r418619;
}

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 +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))