\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \leq -1126.4152090125688 \lor \neg \left(x \leq 0.06506087734989285\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(0.5, \frac{y}{\frac{x \cdot e^{y}}{y}}, e^{-y}\right)}{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 -1126.4152090125688) (not (<= x 0.06506087734989285))) (/ (fma 0.5 (/ y (/ (* x (exp y)) y)) (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 <= -1126.4152090125688) || !(x <= 0.06506087734989285)) {
tmp = fma(0.5, (y / ((x * exp(y)) / y)), exp(-y)) / x;
} else {
tmp = 1.0 / x;
}
return tmp;
}




Bits error versus x




Bits error versus y
| Original | 11.5 |
|---|---|
| Target | 8.1 |
| Herbie | 0.4 |
if x < -1126.41520901256877 or 0.065060877349892854 < x Initial program 11.2
Simplified11.2
Taylor expanded in x around inf 7.5
Simplified0.1
if -1126.41520901256877 < x < 0.065060877349892854Initial program 12.0
Simplified12.0
Taylor expanded in x around 0 0.7
Final simplification0.4
herbie shell --seed 2021340
(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))