(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
(FPCore (x y)
:precision binary64
(if (<= x -3.3e+104)
(/ y (pow x 2.0))
(if (<= x -8e-24)
(* y (/ x (+ (pow (+ x y) 3.0) (pow (+ x y) 2.0))))
(/
x
(+
(+
(fma y y (/ x (/ y x)))
(+ (fma 3.0 (* x x) (* x 2.0)) (/ (pow x 3.0) y)))
(fma 3.0 (* x y) y))))))double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
double code(double x, double y) {
double tmp;
if (x <= -3.3e+104) {
tmp = y / pow(x, 2.0);
} else if (x <= -8e-24) {
tmp = y * (x / (pow((x + y), 3.0) + pow((x + y), 2.0)));
} else {
tmp = x / ((fma(y, y, (x / (y / x))) + (fma(3.0, (x * x), (x * 2.0)) + (pow(x, 3.0) / y))) + fma(3.0, (x * y), y));
}
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) tmp = 0.0 if (x <= -3.3e+104) tmp = Float64(y / (x ^ 2.0)); elseif (x <= -8e-24) tmp = Float64(y * Float64(x / Float64((Float64(x + y) ^ 3.0) + (Float64(x + y) ^ 2.0)))); else tmp = Float64(x / Float64(Float64(fma(y, y, Float64(x / Float64(y / x))) + Float64(fma(3.0, Float64(x * x), Float64(x * 2.0)) + Float64((x ^ 3.0) / y))) + fma(3.0, Float64(x * y), y))); end return 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_] := If[LessEqual[x, -3.3e+104], N[(y / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8e-24], N[(y * N[(x / N[(N[Power[N[(x + y), $MachinePrecision], 3.0], $MachinePrecision] + N[Power[N[(x + y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(N[(y * y + N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(3.0 * N[(x * x), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] + N[(N[Power[x, 3.0], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(3.0 * N[(x * y), $MachinePrecision] + y), $MachinePrecision]), $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}
\mathbf{if}\;x \leq -3.3 \cdot 10^{+104}:\\
\;\;\;\;\frac{y}{{x}^{2}}\\
\mathbf{elif}\;x \leq -8 \cdot 10^{-24}:\\
\;\;\;\;y \cdot \frac{x}{{\left(x + y\right)}^{3} + {\left(x + y\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(\mathsf{fma}\left(y, y, \frac{x}{\frac{y}{x}}\right) + \left(\mathsf{fma}\left(3, x \cdot x, x \cdot 2\right) + \frac{{x}^{3}}{y}\right)\right) + \mathsf{fma}\left(3, x \cdot y, y\right)}\\
\end{array}




Bits error versus x




Bits error versus y
| Original | 20.0 |
|---|---|
| Target | 0.1 |
| Herbie | 5.2 |
if x < -3.29999999999999985e104Initial program 25.6
Simplified13.6
Taylor expanded in x around inf 10.9
if -3.29999999999999985e104 < x < -7.99999999999999939e-24Initial program 8.3
Simplified10.9
Applied egg-rr5.1
if -7.99999999999999939e-24 < x Initial program 20.4
Simplified10.9
Taylor expanded in x around 0 5.5
Simplified2.1
Final simplification5.2
herbie shell --seed 2022162
(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))))