Average Error: 11.0 → 1.9
Time: 5.6s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.006483848542437442574737360700964927673 \lor \neg \left(x \le 2.852199015031174304536241058074557641432 \cdot 10^{-14}\right):\\ \;\;\;\;\frac{e^{-1 \cdot y}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{1}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right)}^{x} \cdot {\left(\frac{x}{\sqrt[3]{x + y}}\right)}^{x}}{x}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \le -7.006483848542437442574737360700964927673 \lor \neg \left(x \le 2.852199015031174304536241058074557641432 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{e^{-1 \cdot y}}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{1}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right)}^{x} \cdot {\left(\frac{x}{\sqrt[3]{x + y}}\right)}^{x}}{x}\\

\end{array}
double f(double x, double y) {
        double r447556 = x;
        double r447557 = y;
        double r447558 = r447556 + r447557;
        double r447559 = r447556 / r447558;
        double r447560 = log(r447559);
        double r447561 = r447556 * r447560;
        double r447562 = exp(r447561);
        double r447563 = r447562 / r447556;
        return r447563;
}

double f(double x, double y) {
        double r447564 = x;
        double r447565 = -7.006483848542437;
        bool r447566 = r447564 <= r447565;
        double r447567 = 2.852199015031174e-14;
        bool r447568 = r447564 <= r447567;
        double r447569 = !r447568;
        bool r447570 = r447566 || r447569;
        double r447571 = -1.0;
        double r447572 = y;
        double r447573 = r447571 * r447572;
        double r447574 = exp(r447573);
        double r447575 = r447574 / r447564;
        double r447576 = 1.0;
        double r447577 = r447564 + r447572;
        double r447578 = cbrt(r447577);
        double r447579 = r447578 * r447578;
        double r447580 = r447576 / r447579;
        double r447581 = pow(r447580, r447564);
        double r447582 = r447564 / r447578;
        double r447583 = pow(r447582, r447564);
        double r447584 = r447581 * r447583;
        double r447585 = r447584 / r447564;
        double r447586 = r447570 ? r447575 : r447585;
        return r447586;
}

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
Target8.2
Herbie1.9
\[\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 < -7.006483848542437 or 2.852199015031174e-14 < x

    1. Initial program 10.3

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Simplified10.3

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\]
    3. Taylor expanded around inf 0.5

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

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

    if -7.006483848542437 < x < 2.852199015031174e-14

    1. Initial program 11.8

      \[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
    2. Simplified11.8

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x + y}\right)}^{x}}{x}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt11.8

      \[\leadsto \frac{{\left(\frac{x}{\color{blue}{\left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right) \cdot \sqrt[3]{x + y}}}\right)}^{x}}{x}\]
    5. Applied *-un-lft-identity11.8

      \[\leadsto \frac{{\left(\frac{\color{blue}{1 \cdot x}}{\left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right) \cdot \sqrt[3]{x + y}}\right)}^{x}}{x}\]
    6. Applied times-frac11.8

      \[\leadsto \frac{{\color{blue}{\left(\frac{1}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}} \cdot \frac{x}{\sqrt[3]{x + y}}\right)}}^{x}}{x}\]
    7. Applied unpow-prod-down3.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -7.006483848542437442574737360700964927673 \lor \neg \left(x \le 2.852199015031174304536241058074557641432 \cdot 10^{-14}\right):\\ \;\;\;\;\frac{e^{-1 \cdot y}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{1}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right)}^{x} \cdot {\left(\frac{x}{\sqrt[3]{x + y}}\right)}^{x}}{x}\\ \end{array}\]

Reproduce

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