?

Average Error: 0.1 → 0.1
Time: 5.5s
Precision: binary64
Cost: 712

?

\[\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} \]
(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}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 2 regimes
  2. if y < -8.5999999999999994e62 or 9.5e15 < y

    1. Initial program 0.3

      \[\left(x \cdot y\right) \cdot \left(1 - y\right) \]
    2. Applied egg-rr0.3

      \[\leadsto \color{blue}{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)} \]
    3. Simplified0.4

      \[\leadsto \color{blue}{\left(y \cdot x\right) \cdot \left(y \cdot \left(\frac{1 - y}{y \cdot x} \cdot x\right)\right)} \]
      Proof

      [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) \]
    4. Taylor expanded in y around inf 0.3

      \[\leadsto \left(y \cdot x\right) \cdot \color{blue}{\left(-1 \cdot y\right)} \]
    5. Simplified0.3

      \[\leadsto \left(y \cdot x\right) \cdot \color{blue}{\left(-y\right)} \]
      Proof

      [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.5e15

    1. Initial program 0.0

      \[\left(x \cdot y\right) \cdot \left(1 - y\right) \]
    2. Simplified0.0

      \[\leadsto \color{blue}{x \cdot \left(y - y \cdot y\right)} \]
      Proof

      [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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.6 \cdot 10^{+62}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{+15}:\\ \;\;\;\;x \cdot \left(y - y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \left(-y\right)\\ \end{array} \]

Alternatives

Alternative 1
Error7.5
Cost648
\[\begin{array}{l} t_0 := \left(-x\right) \cdot \left(y \cdot y\right)\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error2.0
Cost648
\[\begin{array}{l} t_0 := \left(y \cdot x\right) \cdot \left(-y\right)\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error0.1
Cost448
\[\left(x \cdot y\right) \cdot \left(1 - y\right) \]
Alternative 4
Error21.7
Cost192
\[y \cdot x \]

Error

Reproduce?

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)))