?

Average Error: 0.0 → 0.0
Time: 3.3s
Precision: binary64
Cost: 448

?

\[\left(x \cdot y + x\right) + y \]
\[x \cdot y + \left(x + y\right) \]
(FPCore (x y) :precision binary64 (+ (+ (* x y) x) y))
(FPCore (x y) :precision binary64 (+ (* x y) (+ x y)))
double code(double x, double y) {
	return ((x * y) + x) + y;
}
double code(double x, double y) {
	return (x * y) + (x + y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x * y) + x) + y
end function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x * y) + (x + y)
end function
public static double code(double x, double y) {
	return ((x * y) + x) + y;
}
public static double code(double x, double y) {
	return (x * y) + (x + y);
}
def code(x, y):
	return ((x * y) + x) + y
def code(x, y):
	return (x * y) + (x + y)
function code(x, y)
	return Float64(Float64(Float64(x * y) + x) + y)
end
function code(x, y)
	return Float64(Float64(x * y) + Float64(x + y))
end
function tmp = code(x, y)
	tmp = ((x * y) + x) + y;
end
function tmp = code(x, y)
	tmp = (x * y) + (x + y);
end
code[x_, y_] := N[(N[(N[(x * y), $MachinePrecision] + x), $MachinePrecision] + y), $MachinePrecision]
code[x_, y_] := N[(N[(x * y), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + x\right) + y
x \cdot y + \left(x + y\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.0

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

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

    [Start]0.0

    \[ \left(x \cdot y + x\right) + y \]

    rational_best_oopsla_all_46_json_45_simplify-35 [=>]0.0

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

    rational_best_oopsla_all_46_json_45_simplify-82 [=>]0.0

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

    rational_best_oopsla_all_46_json_45_simplify-35 [=>]0.0

    \[ x \cdot y + \color{blue}{\left(x + y\right)} \]
  3. Final simplification0.0

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

Alternatives

Alternative 1
Error23.8
Cost720
\[\begin{array}{l} \mathbf{if}\;x \leq -2.5 \cdot 10^{-28}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-71}:\\ \;\;\;\;y\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{-111}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 2
Error1.0
Cost584
\[\begin{array}{l} t_0 := \left(y + 1\right) \cdot x\\ \mathbf{if}\;x \leq -8 \cdot 10^{+14}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error10.3
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{+14}:\\ \;\;\;\;\left(y + 1\right) \cdot x\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{-38}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;y \cdot x + y\\ \end{array} \]
Alternative 4
Error27.8
Cost460
\[\begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-28}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-73}:\\ \;\;\;\;y\\ \mathbf{elif}\;x \leq -2.8 \cdot 10^{-111}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 5
Error14.0
Cost324
\[\begin{array}{l} \mathbf{if}\;y \leq -4.5:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 6
Error36.6
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (x y)
  :name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
  :precision binary64
  (+ (+ (* x y) x) y))