Average Error: 10.7 → 0.2
Time: 19.6s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.82478823432214161812668457202583340491 \cdot 10^{60} \lor \neg \left(x \le 3.919013061791306373748966507264412939548\right):\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{else}:\\ \;\;\;\;\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}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \le -1.82478823432214161812668457202583340491 \cdot 10^{60} \lor \neg \left(x \le 3.919013061791306373748966507264412939548\right):\\
\;\;\;\;\frac{e^{-y}}{x}\\

\mathbf{else}:\\
\;\;\;\;\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}\\

\end{array}
double f(double x, double y) {
        double r327652 = x;
        double r327653 = y;
        double r327654 = r327652 + r327653;
        double r327655 = r327652 / r327654;
        double r327656 = log(r327655);
        double r327657 = r327652 * r327656;
        double r327658 = exp(r327657);
        double r327659 = r327658 / r327652;
        return r327659;
}

double f(double x, double y) {
        double r327660 = x;
        double r327661 = -1.8247882343221416e+60;
        bool r327662 = r327660 <= r327661;
        double r327663 = 3.9190130617913064;
        bool r327664 = r327660 <= r327663;
        double r327665 = !r327664;
        bool r327666 = r327662 || r327665;
        double r327667 = y;
        double r327668 = -r327667;
        double r327669 = exp(r327668);
        double r327670 = r327669 / r327660;
        double r327671 = cbrt(r327660);
        double r327672 = r327671 * r327671;
        double r327673 = exp(r327672);
        double r327674 = r327667 + r327660;
        double r327675 = r327660 / r327674;
        double r327676 = log(r327675);
        double r327677 = r327676 * r327671;
        double r327678 = pow(r327673, r327677);
        double r327679 = r327678 / r327660;
        double r327680 = r327666 ? r327670 : r327679;
        return r327680;
}

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.7
Target8.0
Herbie0.2
\[\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 < -1.8247882343221416e+60 or 3.9190130617913064 < 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 -1.8247882343221416e+60 < x < 3.9190130617913064

    1. Initial program 9.8

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.82478823432214161812668457202583340491 \cdot 10^{60} \lor \neg \left(x \le 3.919013061791306373748966507264412939548\right):\\ \;\;\;\;\frac{e^{-y}}{x}\\ \mathbf{else}:\\ \;\;\;\;\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}\\ \end{array}\]

Reproduce

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