?

Average Error: 0.1 → 0.1
Time: 7.5s
Precision: binary64
Cost: 448

?

\[\left(x \cdot y\right) \cdot \left(1 - y\right) \]
\[y \cdot \left(x - y \cdot x\right) \]
(FPCore (x y) :precision binary64 (* (* x y) (- 1.0 y)))
(FPCore (x y) :precision binary64 (* y (- x (* y x))))
double code(double x, double y) {
	return (x * y) * (1.0 - y);
}
double code(double x, double y) {
	return y * (x - (y * x));
}
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
    code = y * (x - (y * x))
end function
public static double code(double x, double y) {
	return (x * y) * (1.0 - y);
}
public static double code(double x, double y) {
	return y * (x - (y * x));
}
def code(x, y):
	return (x * y) * (1.0 - y)
def code(x, y):
	return y * (x - (y * x))
function code(x, y)
	return Float64(Float64(x * y) * Float64(1.0 - y))
end
function code(x, y)
	return Float64(y * Float64(x - Float64(y * x)))
end
function tmp = code(x, y)
	tmp = (x * y) * (1.0 - y);
end
function tmp = code(x, y)
	tmp = y * (x - (y * x));
end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(y * N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y\right) \cdot \left(1 - y\right)
y \cdot \left(x - y \cdot x\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.1

    \[\left(x \cdot y\right) \cdot \left(1 - y\right) \]
  2. Simplified5.4

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

    [Start]0.1

    \[ \left(x \cdot y\right) \cdot \left(1 - y\right) \]

    distribute-lft-out-- [<=]0.1

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

    *-rgt-identity [=>]0.1

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

    associate-*l* [=>]5.4

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

    distribute-lft-out-- [=>]5.4

    \[ \color{blue}{x \cdot \left(y - y \cdot y\right)} \]
  3. Taylor expanded in x around 0 5.4

    \[\leadsto \color{blue}{\left(y - {y}^{2}\right) \cdot x} \]
  4. Simplified0.1

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

    [Start]5.4

    \[ \left(y - {y}^{2}\right) \cdot x \]

    *-commutative [=>]5.4

    \[ \color{blue}{x \cdot \left(y - {y}^{2}\right)} \]

    sub-neg [=>]5.4

    \[ x \cdot \color{blue}{\left(y + \left(-{y}^{2}\right)\right)} \]

    unpow2 [=>]5.4

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

    distribute-rgt-out [<=]5.4

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

    cancel-sign-sub-inv [<=]5.4

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

    associate-*l* [=>]0.1

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

    distribute-lft-out-- [=>]0.1

    \[ \color{blue}{y \cdot \left(x - y \cdot x\right)} \]
  5. Final simplification0.1

    \[\leadsto y \cdot \left(x - y \cdot x\right) \]

Alternatives

Alternative 1
Error0.1
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -3 \cdot 10^{+147} \lor \neg \left(y \leq 20000000000000\right):\\ \;\;\;\;y \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y - y \cdot y\right)\\ \end{array} \]
Alternative 2
Error7.1
Cost649
\[\begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;x \cdot \left(y \cdot \left(-y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 3
Error1.8
Cost649
\[\begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;y \cdot \left(y \cdot \left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 4
Error21.8
Cost192
\[y \cdot x \]
Alternative 5
Error61.7
Cost64
\[x \]

Error

Reproduce?

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