| Alternative 1 | |
|---|---|
| Error | 8.1 |
| Cost | 713 |
\[\begin{array}{l}
\mathbf{if}\;z \leq -50000 \lor \neg \left(z \leq 7 \cdot 10^{-81}\right):\\
\;\;\;\;t + y \cdot z\\
\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) 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) + 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) + 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) + z)) + t;
}
def code(x, y, z, t): return (((x * y) + z) * y) + t
def code(x, y, z, t): return (y * ((x * 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(y * Float64(Float64(x * 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) + 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[(y * N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\left(x \cdot y + z\right) \cdot y + t
y \cdot \left(x \cdot y + z\right) + t
Results
Initial program 0.1
Final simplification0.1
| Alternative 1 | |
|---|---|
| Error | 8.1 |
| Cost | 713 |
| Alternative 2 | |
|---|---|
| Error | 5.0 |
| Cost | 713 |
| Alternative 3 | |
|---|---|
| Error | 13.2 |
| Cost | 320 |
herbie shell --seed 2023016
(FPCore (x y z t)
:name "Language.Haskell.HsColour.ColourHighlight:unbase from hscolour-1.23"
:precision binary64
(+ (* (+ (* x y) z) y) t))