\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\begin{array}{l}
\mathbf{if}\;x \le -27740047836885.015625 \lor \neg \left(x \le 2.342700812230118325560812748975525465767 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{e^{-y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(e^{x}\right)}^{\left(\log \left(\frac{x}{x + y}\right)\right)}}{x}\\
\end{array}double f(double x, double y) {
double r258226 = x;
double r258227 = y;
double r258228 = r258226 + r258227;
double r258229 = r258226 / r258228;
double r258230 = log(r258229);
double r258231 = r258226 * r258230;
double r258232 = exp(r258231);
double r258233 = r258232 / r258226;
return r258233;
}
double f(double x, double y) {
double r258234 = x;
double r258235 = -27740047836885.016;
bool r258236 = r258234 <= r258235;
double r258237 = 2.3427008122301183e-07;
bool r258238 = r258234 <= r258237;
double r258239 = !r258238;
bool r258240 = r258236 || r258239;
double r258241 = y;
double r258242 = -r258241;
double r258243 = exp(r258242);
double r258244 = r258243 / r258234;
double r258245 = exp(r258234);
double r258246 = r258234 + r258241;
double r258247 = r258234 / r258246;
double r258248 = log(r258247);
double r258249 = pow(r258245, r258248);
double r258250 = r258249 / r258234;
double r258251 = r258240 ? r258244 : r258250;
return r258251;
}




Bits error versus x




Bits error versus y
Results
| Original | 11.1 |
|---|---|
| Target | 8.3 |
| Herbie | 0.3 |
if x < -27740047836885.016 or 2.3427008122301183e-07 < x Initial program 11.1
Taylor expanded around inf 0.4
Simplified0.4
if -27740047836885.016 < x < 2.3427008122301183e-07Initial program 11.1
rmApplied add-log-exp12.3
Applied exp-to-pow0.2
Final simplification0.3
herbie shell --seed 2019209 +o rules:numerics
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, F"
:precision binary64
:herbie-target
(if (< y -3.73118442066479561e94) (/ (exp (/ -1 y)) x) (if (< y 2.81795924272828789e37) (/ (pow (/ x (+ y x)) x) x) (if (< y 2.347387415166998e178) (log (exp (/ (pow (/ x (+ y x)) x) x))) (/ (exp (/ -1 y)) x))))
(/ (exp (* x (log (/ x (+ x y))))) x))