\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \leq -1.3253362937137794 \cdot 10^{+33} \lor \neg \left(x \leq 2.0664577613658626 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{e^{-y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x}\\
\end{array}
(FPCore (x y) :precision binary64 (/ (exp (* x (log (/ x (+ x y))))) x))
(FPCore (x y) :precision binary64 (if (or (<= x -1.3253362937137794e+33) (not (<= x 2.0664577613658626e-8))) (/ (exp (- y)) x) (/ 1.0 x)))
double code(double x, double y) {
return exp(x * log(x / (x + y))) / x;
}
double code(double x, double y) {
double tmp;
if ((x <= -1.3253362937137794e+33) || !(x <= 2.0664577613658626e-8)) {
tmp = exp(-y) / x;
} else {
tmp = 1.0 / x;
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 11.0 |
|---|---|
| Target | 7.7 |
| Herbie | 0.5 |
if x < -1.3253362937137794e33 or 2.06645776136586257e-8 < x Initial program 10.9
Simplified10.9
Taylor expanded in x around inf 0.4
if -1.3253362937137794e33 < x < 2.06645776136586257e-8Initial program 11.1
Simplified11.1
Taylor expanded in x around 0 0.7
Final simplification0.5
herbie shell --seed 2021224
(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.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))