Average Error: 10.6 → 6.5
Time: 17.6s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;y \le 74.53422455714195:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\log \left(\frac{\frac{x}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}}{\sqrt[3]{x + y}}\right) \cdot x}}{x}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;y \le 74.53422455714195:\\
\;\;\;\;\frac{1}{x}\\

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

\end{array}
double f(double x, double y) {
        double r18312663 = x;
        double r18312664 = y;
        double r18312665 = r18312663 + r18312664;
        double r18312666 = r18312663 / r18312665;
        double r18312667 = log(r18312666);
        double r18312668 = r18312663 * r18312667;
        double r18312669 = exp(r18312668);
        double r18312670 = r18312669 / r18312663;
        return r18312670;
}

double f(double x, double y) {
        double r18312671 = y;
        double r18312672 = 74.53422455714195;
        bool r18312673 = r18312671 <= r18312672;
        double r18312674 = 1.0;
        double r18312675 = x;
        double r18312676 = r18312674 / r18312675;
        double r18312677 = r18312675 + r18312671;
        double r18312678 = cbrt(r18312677);
        double r18312679 = r18312678 * r18312678;
        double r18312680 = r18312675 / r18312679;
        double r18312681 = r18312680 / r18312678;
        double r18312682 = log(r18312681);
        double r18312683 = r18312682 * r18312675;
        double r18312684 = exp(r18312683);
        double r18312685 = r18312684 / r18312675;
        double r18312686 = r18312673 ? r18312676 : r18312685;
        return r18312686;
}

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.6
Target7.7
Herbie6.5
\[\begin{array}{l} \mathbf{if}\;y \lt -3.7311844206647956 \cdot 10^{+94}:\\ \;\;\;\;\frac{e^{\frac{-1}{y}}}{x}\\ \mathbf{elif}\;y \lt 2.817959242728288 \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 y < 74.53422455714195

    1. Initial program 4.0

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

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

    if 74.53422455714195 < y

    1. Initial program 32.8

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

      \[\leadsto \frac{e^{x \cdot \log \left(\frac{x}{\color{blue}{\left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right) \cdot \sqrt[3]{x + y}}}\right)}}{x}\]
    4. Applied associate-/r*24.9

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

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

Reproduce

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