| Alternative 1 | |
|---|---|
| Error | 35.43% |
| Cost | 520 |
\[\begin{array}{l}
\mathbf{if}\;x \leq -7.5:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \leq 1.82 \cdot 10^{-171}:\\
\;\;\;\;t \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\]
(FPCore (x y z t) :precision binary64 (- (* x y) (* z t)))
(FPCore (x y z t) :precision binary64 (+ (* -2.0 (* t z)) (+ (* t z) (* y x))))
double code(double x, double y, double z, double t) {
return (x * y) - (z * t);
}
double code(double x, double y, double z, double t) {
return (-2.0 * (t * z)) + ((t * z) + (y * x));
}
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 * 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 = ((-2.0d0) * (t * z)) + ((t * z) + (y * x))
end function
public static double code(double x, double y, double z, double t) {
return (x * y) - (z * t);
}
public static double code(double x, double y, double z, double t) {
return (-2.0 * (t * z)) + ((t * z) + (y * x));
}
def code(x, y, z, t): return (x * y) - (z * t)
def code(x, y, z, t): return (-2.0 * (t * z)) + ((t * z) + (y * x))
function code(x, y, z, t) return Float64(Float64(x * y) - Float64(z * t)) end
function code(x, y, z, t) return Float64(Float64(-2.0 * Float64(t * z)) + Float64(Float64(t * z) + Float64(y * x))) end
function tmp = code(x, y, z, t) tmp = (x * y) - (z * t); end
function tmp = code(x, y, z, t) tmp = (-2.0 * (t * z)) + ((t * z) + (y * x)); end
code[x_, y_, z_, t_] := N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(-2.0 * N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot y - z \cdot t
-2 \cdot \left(t \cdot z\right) + \left(t \cdot z + y \cdot x\right)
Results
Initial program 0.02
Applied egg-rr0.01
Taylor expanded in x around 0 0.04
Final simplification0.04
| Alternative 1 | |
|---|---|
| Error | 35.43% |
| Cost | 520 |
| Alternative 2 | |
|---|---|
| Error | 0.02% |
| Cost | 448 |
| Alternative 3 | |
|---|---|
| Error | 48.29% |
| Cost | 192 |
herbie shell --seed 2023103
(FPCore (x y z t)
:name "Linear.V3:cross from linear-1.19.1.3"
:precision binary64
(- (* x y) (* z t)))