| Alternative 1 | |
|---|---|
| Accuracy | 87.7% |
| Cost | 713 |
\[\begin{array}{l}
\mathbf{if}\;z \leq -120000000 \lor \neg \left(z \leq 420\right):\\
\;\;\;\;y \cdot z + t\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \left(y \cdot y\right)\\
\end{array}
\]
(FPCore (x y z t) :precision binary64 (+ (* (+ (* x y) z) y) t))
(FPCore (x y z t) :precision binary64 (+ (+ (* y (* x y)) (* y z)) t))
double code(double x, double y, double z, double t) {
return (((x * y) + z) * y) + t;
}
double code(double x, double y, double z, double t) {
return ((y * (x * y)) + (y * z)) + t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * y) + z) * y) + t
end function
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((y * (x * y)) + (y * z)) + t
end function
public static double code(double x, double y, double z, double t) {
return (((x * y) + z) * y) + t;
}
public static double code(double x, double y, double z, double t) {
return ((y * (x * y)) + (y * z)) + t;
}
def code(x, y, z, t): return (((x * y) + z) * y) + t
def code(x, y, z, t): return ((y * (x * y)) + (y * z)) + t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * y) + z) * y) + t) end
function code(x, y, z, t) return Float64(Float64(Float64(y * Float64(x * y)) + Float64(y * z)) + t) end
function tmp = code(x, y, z, t) tmp = (((x * y) + z) * y) + t; end
function tmp = code(x, y, z, t) tmp = ((y * (x * y)) + (y * z)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision] + t), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\left(x \cdot y + z\right) \cdot y + t
\left(y \cdot \left(x \cdot y\right) + y \cdot z\right) + t
Results
Initial program 99.9%
Applied egg-rr99.9%
[Start]99.9 | \[ \left(x \cdot y + z\right) \cdot y + t
\] |
|---|---|
*-commutative [=>]99.9 | \[ \color{blue}{y \cdot \left(x \cdot y + z\right)} + t
\] |
distribute-rgt-in [=>]99.9 | \[ \color{blue}{\left(\left(x \cdot y\right) \cdot y + z \cdot y\right)} + t
\] |
Final simplification99.9%
| Alternative 1 | |
|---|---|
| Accuracy | 87.7% |
| Cost | 713 |
| Alternative 2 | |
|---|---|
| Accuracy | 92.6% |
| Cost | 713 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 576 |
| Alternative 4 | |
|---|---|
| Accuracy | 79.5% |
| Cost | 320 |
herbie shell --seed 2023138
(FPCore (x y z t)
:name "Language.Haskell.HsColour.ColourHighlight:unbase from hscolour-1.23"
:precision binary64
(+ (* (+ (* x y) z) y) t))