| Alternative 1 | |
|---|---|
| Error | 7.5 |
| Cost | 648 |
(FPCore (x y) :precision binary64 (* (* x y) (- 1.0 y)))
(FPCore (x y) :precision binary64 (let* ((t_0 (* (* y x) (- y)))) (if (<= y -8.6e+62) t_0 (if (<= y 9.5e+15) (* x (- y (* y y))) t_0))))
double code(double x, double y) {
return (x * y) * (1.0 - y);
}
double code(double x, double y) {
double t_0 = (y * x) * -y;
double tmp;
if (y <= -8.6e+62) {
tmp = t_0;
} else if (y <= 9.5e+15) {
tmp = x * (y - (y * y));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) * (1.0d0 - y)
end function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (y * x) * -y
if (y <= (-8.6d+62)) then
tmp = t_0
else if (y <= 9.5d+15) then
tmp = x * (y - (y * y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
return (x * y) * (1.0 - y);
}
public static double code(double x, double y) {
double t_0 = (y * x) * -y;
double tmp;
if (y <= -8.6e+62) {
tmp = t_0;
} else if (y <= 9.5e+15) {
tmp = x * (y - (y * y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): return (x * y) * (1.0 - y)
def code(x, y): t_0 = (y * x) * -y tmp = 0 if y <= -8.6e+62: tmp = t_0 elif y <= 9.5e+15: tmp = x * (y - (y * y)) else: tmp = t_0 return tmp
function code(x, y) return Float64(Float64(x * y) * Float64(1.0 - y)) end
function code(x, y) t_0 = Float64(Float64(y * x) * Float64(-y)) tmp = 0.0 if (y <= -8.6e+62) tmp = t_0; elseif (y <= 9.5e+15) tmp = Float64(x * Float64(y - Float64(y * y))); else tmp = t_0; end return tmp end
function tmp = code(x, y) tmp = (x * y) * (1.0 - y); end
function tmp_2 = code(x, y) t_0 = (y * x) * -y; tmp = 0.0; if (y <= -8.6e+62) tmp = t_0; elseif (y <= 9.5e+15) tmp = x * (y - (y * y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[(N[(y * x), $MachinePrecision] * (-y)), $MachinePrecision]}, If[LessEqual[y, -8.6e+62], t$95$0, If[LessEqual[y, 9.5e+15], N[(x * N[(y - N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\left(x \cdot y\right) \cdot \left(1 - y\right)
\begin{array}{l}
t_0 := \left(y \cdot x\right) \cdot \left(-y\right)\\
\mathbf{if}\;y \leq -8.6 \cdot 10^{+62}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{+15}:\\
\;\;\;\;x \cdot \left(y - y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
Results
if y < -8.5999999999999994e62 or 9.5e15 < y Initial program 0.3
Applied egg-rr0.3
Simplified0.4
[Start]0.3 | \[ 0 \cdot \left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right) - \left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right) \cdot \left(y \cdot \left(-x\right)\right)
\] |
|---|---|
rational_best_oopsla_all_46_json_45_simplify-102 [=>]0.3 | \[ \color{blue}{\left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right) \cdot \left(0 - y \cdot \left(-x\right)\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.3 | \[ \color{blue}{\left(0 - y \cdot \left(-x\right)\right) \cdot \left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-97 [=>]0.3 | \[ \left(0 - y \cdot \color{blue}{\left(0 - x\right)}\right) \cdot \left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-13 [=>]0.3 | \[ \left(0 - \color{blue}{\left(0 \cdot y - y \cdot x\right)}\right) \cdot \left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [<=]0.3 | \[ \left(0 - \left(\color{blue}{y \cdot 0} - y \cdot x\right)\right) \cdot \left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-38 [=>]0.3 | \[ \left(0 - \left(\color{blue}{0} - y \cdot x\right)\right) \cdot \left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.3 | \[ \left(0 - \left(0 - \color{blue}{x \cdot y}\right)\right) \cdot \left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-36 [=>]0.3 | \[ \color{blue}{\left(x \cdot y - \left(0 - 0\right)\right)} \cdot \left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right)
\] |
metadata-eval [=>]0.3 | \[ \left(x \cdot y - \color{blue}{0}\right) \cdot \left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-81 [=>]0.3 | \[ \color{blue}{\left(x \cdot y\right)} \cdot \left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [<=]0.3 | \[ \color{blue}{\left(y \cdot x\right)} \cdot \left(\left(x \cdot y\right) \cdot \frac{1 - y}{x \cdot y}\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.3 | \[ \left(y \cdot x\right) \cdot \color{blue}{\left(\frac{1 - y}{x \cdot y} \cdot \left(x \cdot y\right)\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [<=]0.3 | \[ \left(y \cdot x\right) \cdot \left(\frac{1 - y}{x \cdot y} \cdot \color{blue}{\left(y \cdot x\right)}\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-7 [=>]0.4 | \[ \left(y \cdot x\right) \cdot \color{blue}{\left(y \cdot \left(\frac{1 - y}{x \cdot y} \cdot x\right)\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [<=]0.4 | \[ \left(y \cdot x\right) \cdot \left(y \cdot \left(\frac{1 - y}{\color{blue}{y \cdot x}} \cdot x\right)\right)
\] |
Taylor expanded in y around inf 0.3
Simplified0.3
[Start]0.3 | \[ \left(y \cdot x\right) \cdot \left(-1 \cdot y\right)
\] |
|---|---|
rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.3 | \[ \left(y \cdot x\right) \cdot \color{blue}{\left(y \cdot -1\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-94 [<=]0.3 | \[ \left(y \cdot x\right) \cdot \color{blue}{\left(-y\right)}
\] |
if -8.5999999999999994e62 < y < 9.5e15Initial program 0.0
Simplified0.0
[Start]0.0 | \[ \left(x \cdot y\right) \cdot \left(1 - y\right)
\] |
|---|---|
rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.0 | \[ \color{blue}{\left(1 - y\right) \cdot \left(x \cdot y\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-7 [=>]0.0 | \[ \color{blue}{x \cdot \left(\left(1 - y\right) \cdot y\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.0 | \[ x \cdot \color{blue}{\left(y \cdot \left(1 - y\right)\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-13 [=>]0.0 | \[ x \cdot \color{blue}{\left(1 \cdot y - y \cdot y\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.0 | \[ x \cdot \left(\color{blue}{y \cdot 1} - y \cdot y\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-52 [=>]0.0 | \[ x \cdot \left(\color{blue}{y} - y \cdot y\right)
\] |
Final simplification0.1
| Alternative 1 | |
|---|---|
| Error | 7.5 |
| Cost | 648 |
| Alternative 2 | |
|---|---|
| Error | 2.0 |
| Cost | 648 |
| Alternative 3 | |
|---|---|
| Error | 0.1 |
| Cost | 448 |
| Alternative 4 | |
|---|---|
| Error | 21.7 |
| Cost | 192 |
herbie shell --seed 2023090
(FPCore (x y)
:name "Statistics.Distribution.Binomial:$cvariance from math-functions-0.1.5.2"
:precision binary64
(* (* x y) (- 1.0 y)))