Average Error: 10.8 → 0.4
Time: 4.6s
Precision: 64
\[\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -33968180357.561458587646484375:\\ \;\;\;\;\frac{e^{-1 \cdot y}}{x}\\ \mathbf{elif}\;x \le 0.02388541996603257139275555687163432594389:\\ \;\;\;\;\frac{e^{x \cdot 0}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot e^{y}}\\ \end{array}\]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \le -33968180357.561458587646484375:\\
\;\;\;\;\frac{e^{-1 \cdot y}}{x}\\

\mathbf{elif}\;x \le 0.02388541996603257139275555687163432594389:\\
\;\;\;\;\frac{e^{x \cdot 0}}{x}\\

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

\end{array}
double f(double x, double y) {
        double r429948 = x;
        double r429949 = y;
        double r429950 = r429948 + r429949;
        double r429951 = r429948 / r429950;
        double r429952 = log(r429951);
        double r429953 = r429948 * r429952;
        double r429954 = exp(r429953);
        double r429955 = r429954 / r429948;
        return r429955;
}

double f(double x, double y) {
        double r429956 = x;
        double r429957 = -33968180357.56146;
        bool r429958 = r429956 <= r429957;
        double r429959 = -1.0;
        double r429960 = y;
        double r429961 = r429959 * r429960;
        double r429962 = exp(r429961);
        double r429963 = r429962 / r429956;
        double r429964 = 0.02388541996603257;
        bool r429965 = r429956 <= r429964;
        double r429966 = 0.0;
        double r429967 = r429956 * r429966;
        double r429968 = exp(r429967);
        double r429969 = r429968 / r429956;
        double r429970 = 1.0;
        double r429971 = exp(r429960);
        double r429972 = r429956 * r429971;
        double r429973 = r429970 / r429972;
        double r429974 = r429965 ? r429969 : r429973;
        double r429975 = r429958 ? r429963 : r429974;
        return r429975;
}

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.8
Target8.0
Herbie0.4
\[\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 3 regimes
  2. if x < -33968180357.56146

    1. Initial program 11.8

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

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

    if -33968180357.56146 < x < 0.02388541996603257

    1. Initial program 10.9

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

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

    if 0.02388541996603257 < x

    1. Initial program 9.6

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

      \[\leadsto \color{blue}{\frac{e^{-1 \cdot y}}{x}}\]
    3. Using strategy rm
    4. Applied clear-num0.1

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

      \[\leadsto \frac{1}{\color{blue}{x \cdot e^{y}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -33968180357.561458587646484375:\\ \;\;\;\;\frac{e^{-1 \cdot y}}{x}\\ \mathbf{elif}\;x \le 0.02388541996603257139275555687163432594389:\\ \;\;\;\;\frac{e^{x \cdot 0}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot e^{y}}\\ \end{array}\]

Reproduce

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