?

Average Accuracy: 100.0% → 100.0%
Time: 2.3s
Precision: binary64
Cost: 448

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 100.0%

    \[\left(x \cdot y + x\right) + y \]
  2. Taylor expanded in y around 0 100.0%

    \[\leadsto \color{blue}{\left(1 + x\right) \cdot y + x} \]
  3. Final simplification100.0%

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

Alternatives

Alternative 1
Accuracy76.0%
Cost720
\[\begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-97}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+89}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+104}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 2
Accuracy87.9%
Cost589
\[\begin{array}{l} \mathbf{if}\;y \leq -95000000 \lor \neg \left(y \leq 5.7 \cdot 10^{+88}\right) \land y \leq 4 \cdot 10^{+104}:\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 3
Accuracy98.6%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -95000000:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x\right) \cdot y\\ \end{array} \]
Alternative 4
Accuracy99.2%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{-8}:\\ \;\;\;\;x \cdot \left(1 + y\right)\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;\left(1 + x\right) \cdot y\\ \end{array} \]
Alternative 5
Accuracy72.4%
Cost196
\[\begin{array}{l} \mathbf{if}\;x \leq -4.6 \cdot 10^{-66}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 6
Accuracy43.5%
Cost64
\[x \]

Error

Reproduce?

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