| Alternative 1 | |
|---|---|
| Error | 9.9 |
| Cost | 584 |
\[\begin{array}{l}
t_0 := y \cdot \left(x - 1\right)\\
\mathbf{if}\;y \leq -360000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{-43}:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
(FPCore (x y) :precision binary64 (+ x (* (- 1.0 x) (- 1.0 y))))
(FPCore (x y) :precision binary64 (+ (* y (+ x -1.0)) 1.0))
double code(double x, double y) {
return x + ((1.0 - x) * (1.0 - y));
}
double code(double x, double y) {
return (y * (x + -1.0)) + 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + ((1.0d0 - x) * (1.0d0 - y))
end function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y * (x + (-1.0d0))) + 1.0d0
end function
public static double code(double x, double y) {
return x + ((1.0 - x) * (1.0 - y));
}
public static double code(double x, double y) {
return (y * (x + -1.0)) + 1.0;
}
def code(x, y): return x + ((1.0 - x) * (1.0 - y))
def code(x, y): return (y * (x + -1.0)) + 1.0
function code(x, y) return Float64(x + Float64(Float64(1.0 - x) * Float64(1.0 - y))) end
function code(x, y) return Float64(Float64(y * Float64(x + -1.0)) + 1.0) end
function tmp = code(x, y) tmp = x + ((1.0 - x) * (1.0 - y)); end
function tmp = code(x, y) tmp = (y * (x + -1.0)) + 1.0; end
code[x_, y_] := N[(x + N[(N[(1.0 - x), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]
x + \left(1 - x\right) \cdot \left(1 - y\right)
y \cdot \left(x + -1\right) + 1
Results
| Original | 15.9 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 15.9
Simplified0.0
[Start]15.9 | \[ x + \left(1 - x\right) \cdot \left(1 - y\right)
\] |
|---|---|
rational_best_oopsla_all_46_json_45_simplify-87 [=>]15.9 | \[ x + \color{blue}{\left(-\left(1 - x\right)\right) \cdot \left(y - 1\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-13 [=>]15.9 | \[ x + \color{blue}{\left(y \cdot \left(-\left(1 - x\right)\right) - \left(-\left(1 - x\right)\right) \cdot 1\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-52 [=>]15.9 | \[ x + \left(y \cdot \left(-\left(1 - x\right)\right) - \color{blue}{\left(-\left(1 - x\right)\right)}\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-97 [=>]15.9 | \[ x + \left(y \cdot \left(-\left(1 - x\right)\right) - \color{blue}{\left(0 - \left(1 - x\right)\right)}\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-36 [=>]15.9 | \[ x + \left(y \cdot \left(-\left(1 - x\right)\right) - \color{blue}{\left(x - \left(1 - 0\right)\right)}\right)
\] |
metadata-eval [=>]15.9 | \[ x + \left(y \cdot \left(-\left(1 - x\right)\right) - \left(x - \color{blue}{1}\right)\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-45 [=>]15.9 | \[ x + \left(y \cdot \left(-\left(1 - x\right)\right) - \color{blue}{\left(x + -1\right)}\right)
\] |
rational_best_oopsla_all_46_json_45_simplify-109 [=>]0.0 | \[ \color{blue}{y \cdot \left(-\left(1 - x\right)\right) - -1}
\] |
rational_best_oopsla_all_46_json_45_simplify-1 [=>]0.0 | \[ \color{blue}{y \cdot \left(-\left(1 - x\right)\right) + 1}
\] |
rational_best_oopsla_all_46_json_45_simplify-97 [=>]0.0 | \[ y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} + 1
\] |
rational_best_oopsla_all_46_json_45_simplify-36 [=>]0.0 | \[ y \cdot \color{blue}{\left(x - \left(1 - 0\right)\right)} + 1
\] |
metadata-eval [=>]0.0 | \[ y \cdot \left(x - \color{blue}{1}\right) + 1
\] |
rational_best_oopsla_all_46_json_45_simplify-45 [=>]0.0 | \[ y \cdot \color{blue}{\left(x + -1\right)} + 1
\] |
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 9.9 |
| Cost | 584 |
| Alternative 2 | |
|---|---|
| Error | 27.7 |
| Cost | 456 |
| Alternative 3 | |
|---|---|
| Error | 9.8 |
| Cost | 456 |
| Alternative 4 | |
|---|---|
| Error | 36.5 |
| Cost | 64 |
herbie shell --seed 2023090
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.Vectors:renderPlotVectors from Chart-1.5.3"
:precision binary64
:herbie-target
(- (* y x) (- y 1.0))
(+ x (* (- 1.0 x) (- 1.0 y))))