| Alternative 1 | |
|---|---|
| Error | 0.9 |
| Cost | 584 |
\[\begin{array}{l}
t_0 := \left(1 + x\right) \cdot y\\
\mathbf{if}\;y \leq -360000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y - x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
(FPCore (x y) :precision binary64 (- (* (+ x 1.0) y) x))
(FPCore (x y) :precision binary64 (+ y (- (* x y) x)))
double code(double x, double y) {
return ((x + 1.0) * y) - x;
}
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 + 1.0d0) * y) - x
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 + 1.0) * y) - x;
}
public static double code(double x, double y) {
return y + ((x * y) - x);
}
def code(x, y): return ((x + 1.0) * y) - x
def code(x, y): return y + ((x * y) - x)
function code(x, y) return Float64(Float64(Float64(x + 1.0) * y) - x) end
function code(x, y) return Float64(y + Float64(Float64(x * y) - x)) end
function tmp = code(x, y) tmp = ((x + 1.0) * y) - x; end
function tmp = code(x, y) tmp = y + ((x * y) - x); end
code[x_, y_] := N[(N[(N[(x + 1.0), $MachinePrecision] * y), $MachinePrecision] - x), $MachinePrecision]
code[x_, y_] := N[(y + N[(N[(x * y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]
\left(x + 1\right) \cdot y - x
y + \left(x \cdot y - x\right)
Results
Initial program 0.0
Simplified0.0
[Start]0.0 | \[ \left(x + 1\right) \cdot y - x
\] |
|---|---|
rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.0 | \[ \color{blue}{y \cdot \left(x + 1\right)} - x
\] |
rational_best_oopsla_all_46_json_45_simplify-37 [=>]0.0 | \[ \color{blue}{\left(x \cdot y + y \cdot 1\right)} - x
\] |
rational_best_oopsla_all_46_json_45_simplify-52 [=>]0.0 | \[ \left(x \cdot y + \color{blue}{y}\right) - x
\] |
rational_best_oopsla_all_46_json_45_simplify-107 [=>]0.0 | \[ \color{blue}{y + \left(x \cdot y - x\right)}
\] |
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 0.9 |
| Cost | 584 |
| Alternative 2 | |
|---|---|
| Error | 0.9 |
| Cost | 584 |
| Alternative 3 | |
|---|---|
| Error | 19.0 |
| Cost | 392 |
| Alternative 4 | |
|---|---|
| Error | 9.8 |
| Cost | 192 |
| Alternative 5 | |
|---|---|
| Error | 36.0 |
| Cost | 64 |
herbie shell --seed 2023090
(FPCore (x y)
:name "Data.Colour.SRGB:transferFunction from colour-2.3.3"
:precision binary64
(- (* (+ x 1.0) y) x))