\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
\mathbf{if}\;x \leq -3.387941687863428 \cdot 10^{+94} \lor \neg \left(x \leq 3.5823400097921256 \cdot 10^{-30}\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 -3.387941687863428e+94) (not (<= x 3.5823400097921256e-30))) (/ (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 <= -3.387941687863428e+94) || !(x <= 3.5823400097921256e-30)) {
tmp = exp(-y) / x;
} else {
tmp = 1.0 / x;
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 11.1 |
|---|---|
| Target | 7.7 |
| Herbie | 1.1 |
if x < -3.3879416878634283e94 or 3.58234000979212561e-30 < x Initial program 11.1
Simplified11.1
Taylor expanded in x around inf 1.2
if -3.3879416878634283e94 < x < 3.58234000979212561e-30Initial program 11.0
Simplified11.0
Taylor expanded in x around 0 1.0
Final simplification1.1
herbie shell --seed 2021313
(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))