(FPCore (x y) :precision binary64 (/ (exp (* x (log (/ x (+ x y))))) x))
(FPCore (x y)
:precision binary64
(let* ((t_0 (exp (- y))))
(if (<= x -12.932303641541722)
(/ (fma 0.5 (/ (* y (/ y x)) (exp y)) t_0) x)
(if (<= x 7.8205546484089e-32)
(/ 1.0 x)
(/ (fma 0.5 (/ y (* (exp y) (/ x y))) t_0) x)))))double code(double x, double y) {
return exp((x * log((x / (x + y))))) / x;
}
double code(double x, double y) {
double t_0 = exp(-y);
double tmp;
if (x <= -12.932303641541722) {
tmp = fma(0.5, ((y * (y / x)) / exp(y)), t_0) / x;
} else if (x <= 7.8205546484089e-32) {
tmp = 1.0 / x;
} else {
tmp = fma(0.5, (y / (exp(y) * (x / y))), t_0) / x;
}
return tmp;
}
function code(x, y) return Float64(exp(Float64(x * log(Float64(x / Float64(x + y))))) / x) end
function code(x, y) t_0 = exp(Float64(-y)) tmp = 0.0 if (x <= -12.932303641541722) tmp = Float64(fma(0.5, Float64(Float64(y * Float64(y / x)) / exp(y)), t_0) / x); elseif (x <= 7.8205546484089e-32) tmp = Float64(1.0 / x); else tmp = Float64(fma(0.5, Float64(y / Float64(exp(y) * Float64(x / y))), t_0) / x); end return tmp end
code[x_, y_] := N[(N[Exp[N[(x * N[Log[N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[Exp[(-y)], $MachinePrecision]}, If[LessEqual[x, -12.932303641541722], N[(N[(0.5 * N[(N[(y * N[(y / x), $MachinePrecision]), $MachinePrecision] / N[Exp[y], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 7.8205546484089e-32], N[(1.0 / x), $MachinePrecision], N[(N[(0.5 * N[(y / N[(N[Exp[y], $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] / x), $MachinePrecision]]]]
\frac{e^{x \cdot \log \left(\frac{x}{x + y}\right)}}{x}
\begin{array}{l}
t_0 := e^{-y}\\
\mathbf{if}\;x \leq -12.932303641541722:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.5, \frac{y \cdot \frac{y}{x}}{e^{y}}, t_0\right)}{x}\\
\mathbf{elif}\;x \leq 7.8205546484089 \cdot 10^{-32}:\\
\;\;\;\;\frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.5, \frac{y}{e^{y} \cdot \frac{x}{y}}, t_0\right)}{x}\\
\end{array}




Bits error versus x




Bits error versus y
| Original | 11.2 |
|---|---|
| Target | 8.0 |
| Herbie | 0.9 |
if x < -12.932303641541722Initial program 11.4
Simplified11.4
Taylor expanded in x around inf 3.2
Simplified0.1
Applied egg-rr0.1
if -12.932303641541722 < x < 7.8205546484089e-32Initial program 12.4
Simplified12.4
Taylor expanded in x around 0 0.4
if 7.8205546484089e-32 < x Initial program 9.3
Simplified9.3
Taylor expanded in x around inf 12.1
Simplified7.0
Applied egg-rr2.1
Final simplification0.9
herbie shell --seed 2022150
(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))