(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x y))))
(if (<= x -2.4e+160)
(/ (/ y x) x)
(if (<= x 6.4e+94)
(/ (* y t_0) (+ y (+ x (pow (+ x y) 2.0))))
(* t_0 (pow (/ (sqrt y) (hypot (sqrt (+ x y)) (+ x y))) 2.0))))))double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -2.4e+160) {
tmp = (y / x) / x;
} else if (x <= 6.4e+94) {
tmp = (y * t_0) / (y + (x + pow((x + y), 2.0)));
} else {
tmp = t_0 * pow((sqrt(y) / hypot(sqrt((x + y)), (x + y))), 2.0);
}
return tmp;
}
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
public static double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (x <= -2.4e+160) {
tmp = (y / x) / x;
} else if (x <= 6.4e+94) {
tmp = (y * t_0) / (y + (x + Math.pow((x + y), 2.0)));
} else {
tmp = t_0 * Math.pow((Math.sqrt(y) / Math.hypot(Math.sqrt((x + y)), (x + y))), 2.0);
}
return tmp;
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
def code(x, y): t_0 = x / (x + y) tmp = 0 if x <= -2.4e+160: tmp = (y / x) / x elif x <= 6.4e+94: tmp = (y * t_0) / (y + (x + math.pow((x + y), 2.0))) else: tmp = t_0 * math.pow((math.sqrt(y) / math.hypot(math.sqrt((x + y)), (x + y))), 2.0) return tmp
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function code(x, y) t_0 = Float64(x / Float64(x + y)) tmp = 0.0 if (x <= -2.4e+160) tmp = Float64(Float64(y / x) / x); elseif (x <= 6.4e+94) tmp = Float64(Float64(y * t_0) / Float64(y + Float64(x + (Float64(x + y) ^ 2.0)))); else tmp = Float64(t_0 * (Float64(sqrt(y) / hypot(sqrt(Float64(x + y)), Float64(x + y))) ^ 2.0)); end return tmp end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
function tmp_2 = code(x, y) t_0 = x / (x + y); tmp = 0.0; if (x <= -2.4e+160) tmp = (y / x) / x; elseif (x <= 6.4e+94) tmp = (y * t_0) / (y + (x + ((x + y) ^ 2.0))); else tmp = t_0 * ((sqrt(y) / hypot(sqrt((x + y)), (x + y))) ^ 2.0); end tmp_2 = tmp; end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.4e+160], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 6.4e+94], N[(N[(y * t$95$0), $MachinePrecision] / N[(y + N[(x + N[Power[N[(x + y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Power[N[(N[Sqrt[y], $MachinePrecision] / N[Sqrt[N[Sqrt[N[(x + y), $MachinePrecision]], $MachinePrecision] ^ 2 + N[(x + y), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
\mathbf{if}\;x \leq -2.4 \cdot 10^{+160}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq 6.4 \cdot 10^{+94}:\\
\;\;\;\;\frac{y \cdot t_0}{y + \left(x + {\left(x + y\right)}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot {\left(\frac{\sqrt{y}}{\mathsf{hypot}\left(\sqrt{x + y}, x + y\right)}\right)}^{2}\\
\end{array}




Bits error versus x




Bits error versus y
Results
| Original | 20.3 |
|---|---|
| Target | 0.1 |
| Herbie | 2.0 |
if x < -2.4000000000000001e160Initial program 24.6
Simplified11.1
Applied egg-rr11.1
Taylor expanded in x around inf 11.1
Simplified4.6
if -2.4000000000000001e160 < x < 6.40000000000000028e94Initial program 17.3
Simplified11.7
Applied egg-rr11.7
Applied egg-rr1.3
Applied egg-rr1.3
if 6.40000000000000028e94 < x Initial program 63.0
Simplified33.0
Applied egg-rr33.0
Applied egg-rr29.3
Applied egg-rr0.4
Final simplification2.0
herbie shell --seed 2022166
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))