Average Error: 0.1 → 0.3
Time: 5.4s
Precision: binary64
Cost: 712
\[\left(x \cdot y\right) \cdot \left(1 - y\right) \]
\[\begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{+160}:\\ \;\;\;\;\frac{y \cdot x}{\frac{-1}{y}}\\ \mathbf{elif}\;y \leq 10^{+65}:\\ \;\;\;\;x \cdot \left(y \cdot \left(1 - y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{\frac{-1}{y}}{x}}\\ \end{array} \]
(FPCore (x y) :precision binary64 (* (* x y) (- 1.0 y)))
(FPCore (x y)
 :precision binary64
 (if (<= y -1e+160)
   (/ (* y x) (/ -1.0 y))
   (if (<= y 1e+65) (* x (* y (- 1.0 y))) (/ y (/ (/ -1.0 y) x)))))
double code(double x, double y) {
	return (x * y) * (1.0 - y);
}
double code(double x, double y) {
	double tmp;
	if (y <= -1e+160) {
		tmp = (y * x) / (-1.0 / y);
	} else if (y <= 1e+65) {
		tmp = x * (y * (1.0 - y));
	} else {
		tmp = y / ((-1.0 / y) / x);
	}
	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) :: tmp
    if (y <= (-1d+160)) then
        tmp = (y * x) / ((-1.0d0) / y)
    else if (y <= 1d+65) then
        tmp = x * (y * (1.0d0 - y))
    else
        tmp = y / (((-1.0d0) / y) / x)
    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 tmp;
	if (y <= -1e+160) {
		tmp = (y * x) / (-1.0 / y);
	} else if (y <= 1e+65) {
		tmp = x * (y * (1.0 - y));
	} else {
		tmp = y / ((-1.0 / y) / x);
	}
	return tmp;
}
def code(x, y):
	return (x * y) * (1.0 - y)
def code(x, y):
	tmp = 0
	if y <= -1e+160:
		tmp = (y * x) / (-1.0 / y)
	elif y <= 1e+65:
		tmp = x * (y * (1.0 - y))
	else:
		tmp = y / ((-1.0 / y) / x)
	return tmp
function code(x, y)
	return Float64(Float64(x * y) * Float64(1.0 - y))
end
function code(x, y)
	tmp = 0.0
	if (y <= -1e+160)
		tmp = Float64(Float64(y * x) / Float64(-1.0 / y));
	elseif (y <= 1e+65)
		tmp = Float64(x * Float64(y * Float64(1.0 - y)));
	else
		tmp = Float64(y / Float64(Float64(-1.0 / y) / x));
	end
	return tmp
end
function tmp = code(x, y)
	tmp = (x * y) * (1.0 - y);
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1e+160)
		tmp = (y * x) / (-1.0 / y);
	elseif (y <= 1e+65)
		tmp = x * (y * (1.0 - y));
	else
		tmp = y / ((-1.0 / y) / x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := If[LessEqual[y, -1e+160], N[(N[(y * x), $MachinePrecision] / N[(-1.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+65], N[(x * N[(y * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(N[(-1.0 / y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\left(x \cdot y\right) \cdot \left(1 - y\right)
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+160}:\\
\;\;\;\;\frac{y \cdot x}{\frac{-1}{y}}\\

\mathbf{elif}\;y \leq 10^{+65}:\\
\;\;\;\;x \cdot \left(y \cdot \left(1 - y\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{\frac{-1}{y}}{x}}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if y < -1.00000000000000001e160

    1. Initial program 0.3

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

      \[\leadsto \color{blue}{\frac{\left(x \cdot y\right) \cdot \left(1 - y \cdot y\right)}{y + 1}} \]
    3. Applied egg-rr0.4

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{\frac{1}{1 - y}}} \]
    4. Applied egg-rr0.4

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{1}{1 - y}}} \]
    5. Taylor expanded in y around inf 0.4

      \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{-1}{y}}} \]

    if -1.00000000000000001e160 < y < 9.9999999999999999e64

    1. Initial program 0.1

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

      \[\leadsto \color{blue}{{\left(\sqrt{\left(x \cdot y\right) \cdot \left(1 - y\right)}\right)}^{2}} \]
    3. Applied egg-rr0.2

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

    if 9.9999999999999999e64 < y

    1. Initial program 0.3

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

      \[\leadsto \color{blue}{\frac{\left(x \cdot y\right) \cdot \left(1 - y \cdot y\right)}{y + 1}} \]
    3. Applied egg-rr0.4

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{\frac{1}{1 - y}}} \]
    4. Applied egg-rr0.4

      \[\leadsto \color{blue}{\frac{y}{\frac{\frac{1}{1 - y}}{x}}} \]
    5. Taylor expanded in y around inf 0.4

      \[\leadsto \frac{y}{\frac{\color{blue}{\frac{-1}{y}}}{x}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{+160}:\\ \;\;\;\;\frac{y \cdot x}{\frac{-1}{y}}\\ \mathbf{elif}\;y \leq 10^{+65}:\\ \;\;\;\;x \cdot \left(y \cdot \left(1 - y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{\frac{-1}{y}}{x}}\\ \end{array} \]

Alternatives

Alternative 1
Error2.8
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -5.838124845251465 \cdot 10^{+20}:\\ \;\;\;\;\frac{y \cdot x}{\frac{-1}{y}}\\ \mathbf{elif}\;y \leq 0.0003676134116460638:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{\frac{-1}{y}}{x}}\\ \end{array} \]
Alternative 2
Error7.8
Cost648
\[\begin{array}{l} t_0 := x \cdot \left(y \cdot \left(-y\right)\right)\\ \mathbf{if}\;y \leq -5.838124845251465 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.0003676134116460638:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error2.8
Cost648
\[\begin{array}{l} t_0 := y \cdot \left(x \cdot \left(-y\right)\right)\\ \mathbf{if}\;y \leq -5.838124845251465 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.0003676134116460638:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error2.8
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -5.838124845251465 \cdot 10^{+20}:\\ \;\;\;\;\frac{y \cdot x}{\frac{-1}{y}}\\ \mathbf{elif}\;y \leq 0.0003676134116460638:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot \left(-y\right)\right)\\ \end{array} \]
Alternative 5
Error0.1
Cost448
\[y \cdot \left(x - y \cdot x\right) \]
Alternative 6
Error21.4
Cost192
\[y \cdot x \]

Error

Reproduce

herbie shell --seed 2022216 
(FPCore (x y)
  :name "Statistics.Distribution.Binomial:$cvariance from math-functions-0.1.5.2"
  :precision binary64
  (* (* x y) (- 1.0 y)))