\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}\begin{array}{l}
\mathbf{if}\;\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x} \leq -8.132958944010024 \cdot 10^{+27}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{elif}\;\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x} \leq -3.578189530103608 \cdot 10^{-204}:\\
\;\;\;\;\frac{1}{x \cdot e^{y}}\\
\mathbf{elif}\;\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x} \leq 0:\\
\;\;\;\;\frac{{\left(e^{x}\right)}^{\left(\frac{-y}{x}\right)}}{x}\\
\mathbf{elif}\;\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x} \leq 1.820444830454397 \cdot 10^{-66}:\\
\;\;\;\;\frac{e^{-y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(e^{\sqrt{x}}\right)}^{\left(\log \left(\frac{x}{x + y}\right) \cdot \sqrt{x}\right)}}{x}\\
\end{array}(FPCore (x y) :precision binary64 (/ (exp (* x (log (/ x (+ x y))))) x))
(FPCore (x y)
:precision binary64
(if (<= (/ (exp (* x (log (/ x (+ x y))))) x) -8.132958944010024e+27)
(/ 1.0 x)
(if (<= (/ (exp (* x (log (/ x (+ x y))))) x) -3.578189530103608e-204)
(/ 1.0 (* x (exp y)))
(if (<= (/ (exp (* x (log (/ x (+ x y))))) x) 0.0)
(/ (pow (exp x) (/ (- y) x)) x)
(if (<= (/ (exp (* x (log (/ x (+ x y))))) x) 1.820444830454397e-66)
(/ (exp (- y)) x)
(/ (pow (exp (sqrt x)) (* (log (/ x (+ x y))) (sqrt x))) x))))))double code(double x, double y) {
return exp(x * log(x / (x + y))) / x;
}
double code(double x, double y) {
double tmp;
if ((exp(x * log(x / (x + y))) / x) <= -8.132958944010024e+27) {
tmp = 1.0 / x;
} else if ((exp(x * log(x / (x + y))) / x) <= -3.578189530103608e-204) {
tmp = 1.0 / (x * exp(y));
} else if ((exp(x * log(x / (x + y))) / x) <= 0.0) {
tmp = pow(exp(x), (-y / x)) / x;
} else if ((exp(x * log(x / (x + y))) / x) <= 1.820444830454397e-66) {
tmp = exp(-y) / x;
} else {
tmp = pow(exp(sqrt(x)), (log(x / (x + y)) * sqrt(x))) / x;
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 11.5 |
|---|---|
| Target | 7.9 |
| Herbie | 1.6 |
if (/.f64 (exp.f64 (*.f64 x (log.f64 (/.f64 x (+.f64 x y))))) x) < -8.1329589440100238e27Initial program 13.1
Simplified0.0
Taylor expanded around inf 0.1
Simplified0.1
Taylor expanded around inf 0.1
Simplified25.8
Taylor expanded around 0 0.1
if -8.1329589440100238e27 < (/.f64 (exp.f64 (*.f64 x (log.f64 (/.f64 x (+.f64 x y))))) x) < -3.57818953010360778e-204Initial program 7.7
Simplified8.0
Taylor expanded around inf 33.8
Simplified33.8
Taylor expanded around inf 47.4
Simplified2.8
rmApplied neg-sub0_binary64_184872.8
Applied exp-diff_binary64_185402.8
Applied associate-/l/_binary64_184392.8
if -3.57818953010360778e-204 < (/.f64 (exp.f64 (*.f64 x (log.f64 (/.f64 x (+.f64 x y))))) x) < 0.0Initial program 23.9
Simplified8.8
Taylor expanded around inf 4.8
Simplified4.8
if 0.0 < (/.f64 (exp.f64 (*.f64 x (log.f64 (/.f64 x (+.f64 x y))))) x) < 1.820444830454397e-66Initial program 14.0
Simplified14.0
Taylor expanded around inf 22.6
Simplified22.6
Taylor expanded around 0 0.1
if 1.820444830454397e-66 < (/.f64 (exp.f64 (*.f64 x (log.f64 (/.f64 x (+.f64 x y))))) x) Initial program 0.5
Simplified0.8
rmApplied add-sqr-sqrt_binary64_185140.8
Applied exp-prod_binary64_185440.8
Applied pow-pow_binary64_185640.6
Simplified0.6
Final simplification1.6
herbie shell --seed 2021176
(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))