Average Error: 11.7 → 0.1
Time: 24.6s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -273871659249718502616395277602884943872:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{elif}\;x \le 6.903129057972266835463415191043168306351:\\ \;\;\;\;\frac{{\left(e^{\sqrt[3]{x} \cdot \sqrt[3]{x}}\right)}^{\left(\log \left(\frac{x}{y + x}\right) \cdot \sqrt[3]{x}\right)}}{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 -273871659249718502616395277602884943872:\\
\;\;\;\;\frac{e^{-y}}{x}\\

\mathbf{elif}\;x \le 6.903129057972266835463415191043168306351:\\
\;\;\;\;\frac{{\left(e^{\sqrt[3]{x} \cdot \sqrt[3]{x}}\right)}^{\left(\log \left(\frac{x}{y + x}\right) \cdot \sqrt[3]{x}\right)}}{x}\\

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

\end{array}
double f(double x, double y) {
        double r17832464 = x;
        double r17832465 = y;
        double r17832466 = r17832464 + r17832465;
        double r17832467 = r17832464 / r17832466;
        double r17832468 = log(r17832467);
        double r17832469 = r17832464 * r17832468;
        double r17832470 = exp(r17832469);
        double r17832471 = r17832470 / r17832464;
        return r17832471;
}

double f(double x, double y) {
        double r17832472 = x;
        double r17832473 = -2.738716592497185e+38;
        bool r17832474 = r17832472 <= r17832473;
        double r17832475 = y;
        double r17832476 = -r17832475;
        double r17832477 = exp(r17832476);
        double r17832478 = r17832477 / r17832472;
        double r17832479 = 6.903129057972267;
        bool r17832480 = r17832472 <= r17832479;
        double r17832481 = cbrt(r17832472);
        double r17832482 = r17832481 * r17832481;
        double r17832483 = exp(r17832482);
        double r17832484 = r17832475 + r17832472;
        double r17832485 = r17832472 / r17832484;
        double r17832486 = log(r17832485);
        double r17832487 = r17832486 * r17832481;
        double r17832488 = pow(r17832483, r17832487);
        double r17832489 = r17832488 / r17832472;
        double r17832490 = r17832480 ? r17832489 : r17832478;
        double r17832491 = r17832474 ? r17832478 : r17832490;
        return r17832491;
}

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.7
Target8.0
Herbie0.1
\[\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 < -2.738716592497185e+38 or 6.903129057972267 < x

    1. Initial program 11.7

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

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

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

    if -2.738716592497185e+38 < x < 6.903129057972267

    1. Initial program 11.7

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

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

      \[\leadsto \frac{\color{blue}{{\left(e^{x}\right)}^{\left(\log \left(\frac{x}{x + y}\right)\right)}}}{x}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt0.3

      \[\leadsto \frac{{\left(e^{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}\right)}^{\left(\log \left(\frac{x}{x + y}\right)\right)}}{x}\]
    7. Applied exp-prod0.3

      \[\leadsto \frac{{\color{blue}{\left({\left(e^{\sqrt[3]{x} \cdot \sqrt[3]{x}}\right)}^{\left(\sqrt[3]{x}\right)}\right)}}^{\left(\log \left(\frac{x}{x + y}\right)\right)}}{x}\]
    8. Applied pow-pow0.2

      \[\leadsto \frac{\color{blue}{{\left(e^{\sqrt[3]{x} \cdot \sqrt[3]{x}}\right)}^{\left(\sqrt[3]{x} \cdot \log \left(\frac{x}{x + y}\right)\right)}}}{x}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -273871659249718502616395277602884943872:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{elif}\;x \le 6.903129057972266835463415191043168306351:\\ \;\;\;\;\frac{{\left(e^{\sqrt[3]{x} \cdot \sqrt[3]{x}}\right)}^{\left(\log \left(\frac{x}{y + x}\right) \cdot \sqrt[3]{x}\right)}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{-y}}{x}\\ \end{array}\]

Reproduce

herbie shell --seed 2019170 +o rules:numerics
(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))