\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 -2.072636373236087 \cdot 10^{+60}:\\
\;\;\;\;\frac{{\left(\frac{1}{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}\right)}^{x} \cdot {\left(\frac{x}{\sqrt[3]{x + y}}\right)}^{x}}{x}\\
\mathbf{elif}\;\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x} \leq -2.422262997602561 \cdot 10^{-308}:\\
\;\;\;\;\frac{e^{-y}}{x}\\
\mathbf{elif}\;\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x} \leq 0:\\
\;\;\;\;\frac{{\left(\frac{\sqrt{x}}{\sqrt{x + y}}\right)}^{x} \cdot {\left(\frac{\sqrt{x}}{\sqrt{x + y}}\right)}^{x}}{x}\\
\mathbf{elif}\;\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x} \leq 1.3075445047601994 \cdot 10^{-13}:\\
\;\;\;\;\frac{e^{-y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\sqrt{x} \cdot \frac{\sqrt{x}}{x + y}\right)}^{x}}{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) -2.072636373236087e+60)
(/
(*
(pow (/ 1.0 (* (cbrt (+ x y)) (cbrt (+ x y)))) x)
(pow (/ x (cbrt (+ x y))) x))
x)
(if (<= (/ (exp (* x (log (/ x (+ x y))))) x) -2.422262997602561e-308)
(/ (exp (- y)) x)
(if (<= (/ (exp (* x (log (/ x (+ x y))))) x) 0.0)
(/
(*
(pow (/ (sqrt x) (sqrt (+ x y))) x)
(pow (/ (sqrt x) (sqrt (+ x y))) x))
x)
(if (<= (/ (exp (* x (log (/ x (+ x y))))) x) 1.3075445047601994e-13)
(/ (exp (- y)) x)
(/ (pow (* (sqrt x) (/ (sqrt x) (+ x y))) 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) <= -2.072636373236087e+60) {
tmp = (pow((1.0 / (cbrt(x + y) * cbrt(x + y))), x) * pow((x / cbrt(x + y)), x)) / x;
} else if ((exp(x * log(x / (x + y))) / x) <= -2.422262997602561e-308) {
tmp = exp(-y) / x;
} else if ((exp(x * log(x / (x + y))) / x) <= 0.0) {
tmp = (pow((sqrt(x) / sqrt(x + y)), x) * pow((sqrt(x) / sqrt(x + y)), x)) / x;
} else if ((exp(x * log(x / (x + y))) / x) <= 1.3075445047601994e-13) {
tmp = exp(-y) / x;
} else {
tmp = pow((sqrt(x) * (sqrt(x) / (x + y))), x) / x;
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 10.6 |
|---|---|
| Target | 7.9 |
| Herbie | 2.2 |
if (/.f64 (exp.f64 (*.f64 x (log.f64 (/.f64 x (+.f64 x y))))) x) < -2.0726363732360869e60Initial program 15.1
Simplified15.1
rmApplied add-cube-cbrt_binary64_1136615.1
Applied *-un-lft-identity_binary64_1133115.1
Applied times-frac_binary64_1133715.1
Applied unpow-prod-down_binary64_114103.2
if -2.0726363732360869e60 < (/.f64 (exp.f64 (*.f64 x (log.f64 (/.f64 x (+.f64 x y))))) x) < -2.42226299760256108e-308 or 0.0 < (/.f64 (exp.f64 (*.f64 x (log.f64 (/.f64 x (+.f64 x y))))) x) < 1.3075445047601994e-13Initial program 10.6
Simplified10.6
Taylor expanded around inf 2.3
if -2.42226299760256108e-308 < (/.f64 (exp.f64 (*.f64 x (log.f64 (/.f64 x (+.f64 x y))))) x) < 0.0Initial program 24.7
Simplified24.7
rmApplied add-sqr-sqrt_binary64_1135328.2
Applied add-sqr-sqrt_binary64_1135328.3
Applied times-frac_binary64_1133728.3
Applied unpow-prod-down_binary64_114103.7
if 1.3075445047601994e-13 < (/.f64 (exp.f64 (*.f64 x (log.f64 (/.f64 x (+.f64 x y))))) x) Initial program 0.0
Simplified0.0
rmApplied *-un-lft-identity_binary64_113310.0
Applied add-sqr-sqrt_binary64_113530.4
Applied times-frac_binary64_113370.4
Simplified0.4
Final simplification2.2
herbie shell --seed 2020355
(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))