?

Average Error: 0.02% → 0.04%
Time: 6.5s
Precision: binary64
Cost: 832

?

\[x \cdot y - z \cdot t \]
\[-2 \cdot \left(t \cdot z\right) + \left(t \cdot z + y \cdot x\right) \]
(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)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.02

    \[x \cdot y - z \cdot t \]
  2. Applied egg-rr0.01

    \[\leadsto \color{blue}{z \cdot \left(-t\right) + \left(x \cdot y + \mathsf{fma}\left(-z, t, z \cdot t\right)\right)} \]
  3. Taylor expanded in x around 0 0.04

    \[\leadsto \color{blue}{-2 \cdot \left(t \cdot z\right) + \left(y \cdot x + t \cdot z\right)} \]
  4. Final simplification0.04

    \[\leadsto -2 \cdot \left(t \cdot z\right) + \left(t \cdot z + y \cdot x\right) \]

Alternatives

Alternative 1
Error35.43%
Cost520
\[\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} \]
Alternative 2
Error0.02%
Cost448
\[y \cdot x - t \cdot z \]
Alternative 3
Error48.29%
Cost192
\[y \cdot x \]

Error

Reproduce?

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)))