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

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

\end{array}
double f(double x, double y) {
        double r8754849 = x;
        double r8754850 = y;
        double r8754851 = r8754849 + r8754850;
        double r8754852 = r8754849 / r8754851;
        double r8754853 = log(r8754852);
        double r8754854 = r8754849 * r8754853;
        double r8754855 = exp(r8754854);
        double r8754856 = r8754855 / r8754849;
        return r8754856;
}

double f(double x, double y) {
        double r8754857 = y;
        double r8754858 = 526918.3282767582;
        bool r8754859 = r8754857 <= r8754858;
        double r8754860 = x;
        double r8754861 = cbrt(r8754860);
        double r8754862 = r8754860 + r8754857;
        double r8754863 = cbrt(r8754862);
        double r8754864 = r8754861 / r8754863;
        double r8754865 = log(r8754864);
        double r8754866 = r8754865 + r8754865;
        double r8754867 = r8754865 + r8754866;
        double r8754868 = r8754867 * r8754860;
        double r8754869 = exp(r8754868);
        double r8754870 = r8754869 / r8754860;
        double r8754871 = /* ERROR: no posit support in C */;
        double r8754872 = /* ERROR: no posit support in C */;
        double r8754873 = r8754872 / r8754863;
        double r8754874 = log(r8754873);
        double r8754875 = r8754874 + r8754866;
        double r8754876 = r8754860 * r8754875;
        double r8754877 = exp(r8754876);
        double r8754878 = r8754877 / r8754860;
        double r8754879 = r8754859 ? r8754870 : r8754878;
        return r8754879;
}

Error

Bits error versus x

Bits error versus y

Target

Original11.1
Target7.4
Herbie3.8
\[\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 < 526918.3282767582

    1. Initial program 4.4

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

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

      \[\leadsto \frac{e^{x \cdot \log \left(\frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right) \cdot \sqrt[3]{x + y}}\right)}}{x}\]
    5. Applied times-frac4.4

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

      \[\leadsto \frac{e^{x \cdot \color{blue}{\left(\log \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}}{x}\]
    7. Using strategy rm
    8. Applied times-frac1.6

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

      \[\leadsto \frac{e^{x \cdot \left(\color{blue}{\left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)} + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{x}\]

    if 526918.3282767582 < y

    1. Initial program 33.0

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

      \[\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 add-cube-cbrt33.1

      \[\leadsto \frac{e^{x \cdot \log \left(\frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\left(\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}\right) \cdot \sqrt[3]{x + y}}\right)}}{x}\]
    5. Applied times-frac33.1

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

      \[\leadsto \frac{e^{x \cdot \color{blue}{\left(\log \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}}{x}\]
    7. Using strategy rm
    8. Applied times-frac23.8

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

      \[\leadsto \frac{e^{x \cdot \left(\color{blue}{\left(\log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right) + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)} + \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{x + y}}\right)\right)}}{x}\]
    10. Using strategy rm
    11. Applied insert-posit1613.0

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

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

Reproduce

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