| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 448 |
\[2 \cdot \left(x \cdot \left(x - y\right)\right)
\]
(FPCore (x y) :precision binary64 (* 2.0 (- (* x x) (* x y))))
(FPCore (x y) :precision binary64 (* (- y x) (* -2.0 x)))
double code(double x, double y) {
return 2.0 * ((x * x) - (x * y));
}
double code(double x, double y) {
return (y - x) * (-2.0 * x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 2.0d0 * ((x * x) - (x * y))
end function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y - x) * ((-2.0d0) * x)
end function
public static double code(double x, double y) {
return 2.0 * ((x * x) - (x * y));
}
public static double code(double x, double y) {
return (y - x) * (-2.0 * x);
}
def code(x, y): return 2.0 * ((x * x) - (x * y))
def code(x, y): return (y - x) * (-2.0 * x)
function code(x, y) return Float64(2.0 * Float64(Float64(x * x) - Float64(x * y))) end
function code(x, y) return Float64(Float64(y - x) * Float64(-2.0 * x)) end
function tmp = code(x, y) tmp = 2.0 * ((x * x) - (x * y)); end
function tmp = code(x, y) tmp = (y - x) * (-2.0 * x); end
code[x_, y_] := N[(2.0 * N[(N[(x * x), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[(y - x), $MachinePrecision] * N[(-2.0 * x), $MachinePrecision]), $MachinePrecision]
2 \cdot \left(x \cdot x - x \cdot y\right)
\left(y - x\right) \cdot \left(-2 \cdot x\right)
Results
| Original | 0.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 0.0
Applied egg-rr0.0
Simplified0.0
[Start]0.0 | \[ x \cdot \left(x - y\right) + x \cdot \left(x - y\right)
\] |
|---|---|
rational.json-simplify-7 [<=]0.0 | \[ x \cdot \left(x - y\right) + \color{blue}{\frac{x \cdot \left(x - y\right)}{1}}
\] |
rational.json-simplify-30 [<=]0.0 | \[ \color{blue}{\left(1 + 1\right) \cdot \frac{x \cdot \left(x - y\right)}{1}}
\] |
metadata-eval [=>]0.0 | \[ \color{blue}{2} \cdot \frac{x \cdot \left(x - y\right)}{1}
\] |
metadata-eval [<=]0.0 | \[ \color{blue}{\left(1 - -1\right)} \cdot \frac{x \cdot \left(x - y\right)}{1}
\] |
rational.json-simplify-7 [=>]0.0 | \[ \left(1 - -1\right) \cdot \color{blue}{\left(x \cdot \left(x - y\right)\right)}
\] |
rational.json-simplify-5 [<=]0.0 | \[ \left(1 - -1\right) \cdot \left(x \cdot \left(x - \color{blue}{\left(y - 0\right)}\right)\right)
\] |
rational.json-simplify-45 [<=]0.0 | \[ \left(1 - -1\right) \cdot \left(x \cdot \color{blue}{\left(0 - \left(y - x\right)\right)}\right)
\] |
rational.json-simplify-12 [<=]0.0 | \[ \left(1 - -1\right) \cdot \left(x \cdot \color{blue}{\left(-\left(y - x\right)\right)}\right)
\] |
rational.json-simplify-10 [=>]0.0 | \[ \left(1 - -1\right) \cdot \left(x \cdot \color{blue}{\frac{y - x}{-1}}\right)
\] |
rational.json-simplify-49 [<=]0.0 | \[ \left(1 - -1\right) \cdot \color{blue}{\frac{\left(y - x\right) \cdot x}{-1}}
\] |
rational.json-simplify-2 [<=]0.0 | \[ \left(1 - -1\right) \cdot \frac{\color{blue}{x \cdot \left(y - x\right)}}{-1}
\] |
rational.json-simplify-32 [=>]0.0 | \[ \color{blue}{\frac{x \cdot \left(y - x\right)}{-1} - x \cdot \left(y - x\right)}
\] |
rational.json-simplify-49 [=>]0.0 | \[ \color{blue}{\left(y - x\right) \cdot \frac{x}{-1}} - x \cdot \left(y - x\right)
\] |
rational.json-simplify-52 [=>]0.0 | \[ \color{blue}{\left(y - x\right) \cdot \left(\frac{x}{-1} - x\right)}
\] |
rational.json-simplify-11 [=>]0.0 | \[ \left(y - x\right) \cdot \left(\color{blue}{\left(-x\right)} - x\right)
\] |
rational.json-simplify-9 [<=]0.0 | \[ \left(y - x\right) \cdot \left(\color{blue}{x \cdot -1} - x\right)
\] |
rational.json-simplify-6 [<=]0.0 | \[ \left(y - x\right) \cdot \left(x \cdot -1 - \color{blue}{1 \cdot x}\right)
\] |
rational.json-simplify-52 [=>]0.0 | \[ \left(y - x\right) \cdot \color{blue}{\left(x \cdot \left(-1 - 1\right)\right)}
\] |
metadata-eval [=>]0.0 | \[ \left(y - x\right) \cdot \left(x \cdot \color{blue}{-2}\right)
\] |
rational.json-simplify-2 [=>]0.0 | \[ \left(y - x\right) \cdot \color{blue}{\left(-2 \cdot x\right)}
\] |
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 448 |
| Alternative 2 | |
|---|---|
| Error | 22.3 |
| Cost | 320 |
herbie shell --seed 2023064
(FPCore (x y)
:name "Linear.Matrix:fromQuaternion from linear-1.19.1.3, A"
:precision binary64
:herbie-target
(* (* x 2.0) (- x y))
(* 2.0 (- (* x x) (* x y))))