?

Average Accuracy: 100.0% → 100.0%
Time: 11.9s
Precision: binary64
Cost: 832

?

\[x + \left(y - z\right) \cdot \left(t - x\right) \]
\[x + \left(\left(t - x\right) \cdot y + z \cdot \left(x - t\right)\right) \]
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
(FPCore (x y z t) :precision binary64 (+ x (+ (* (- t x) y) (* z (- x t)))))
double code(double x, double y, double z, double t) {
	return x + ((y - z) * (t - x));
}
double code(double x, double y, double z, double t) {
	return x + (((t - x) * y) + (z * (x - 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) * (t - x))
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 = x + (((t - x) * y) + (z * (x - t)))
end function
public static double code(double x, double y, double z, double t) {
	return x + ((y - z) * (t - x));
}
public static double code(double x, double y, double z, double t) {
	return x + (((t - x) * y) + (z * (x - t)));
}
def code(x, y, z, t):
	return x + ((y - z) * (t - x))
def code(x, y, z, t):
	return x + (((t - x) * y) + (z * (x - t)))
function code(x, y, z, t)
	return Float64(x + Float64(Float64(y - z) * Float64(t - x)))
end
function code(x, y, z, t)
	return Float64(x + Float64(Float64(Float64(t - x) * y) + Float64(z * Float64(x - t))))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y - z) * (t - x));
end
function tmp = code(x, y, z, t)
	tmp = x + (((t - x) * y) + (z * (x - t)));
end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(y - z\right) \cdot \left(t - x\right)
x + \left(\left(t - x\right) \cdot y + z \cdot \left(x - t\right)\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original100.0%
Target100.0%
Herbie100.0%
\[x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right) \]

Derivation?

  1. Initial program 100.0%

    \[x + \left(y - z\right) \cdot \left(t - x\right) \]
  2. Applied egg-rr100.0%

    \[\leadsto x + \color{blue}{\left(\left(t - x\right) \cdot \left(-z\right) + \left(t - x\right) \cdot y\right)} \]
    Proof

    [Start]100.0

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

    *-commutative [=>]100.0

    \[ x + \color{blue}{\left(t - x\right) \cdot \left(y - z\right)} \]

    sub-neg [=>]100.0

    \[ x + \left(t - x\right) \cdot \color{blue}{\left(y + \left(-z\right)\right)} \]

    distribute-lft-in [=>]100.0

    \[ x + \color{blue}{\left(\left(t - x\right) \cdot y + \left(t - x\right) \cdot \left(-z\right)\right)} \]

    +-commutative [=>]100.0

    \[ x + \color{blue}{\left(\left(t - x\right) \cdot \left(-z\right) + \left(t - x\right) \cdot y\right)} \]
  3. Final simplification100.0%

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

Alternatives

Alternative 1
Accuracy64.1%
Cost1508
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := t \cdot \left(y - z\right)\\ t_3 := x \cdot \left(1 - y\right)\\ \mathbf{if}\;z \leq -6.2 \cdot 10^{-15}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-293}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-218}:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-152}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{-149}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-149}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-93}:\\ \;\;\;\;x - t \cdot z\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-76}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-11}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Accuracy64.2%
Cost1508
\[\begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ t_2 := z \cdot \left(x - t\right)\\ t_3 := x \cdot \left(1 - y\right)\\ \mathbf{if}\;z \leq -6.6 \cdot 10^{-15}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-293}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-221}:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-152}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{-149}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-149}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{-93}:\\ \;\;\;\;x - t \cdot z\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-76}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-11}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Accuracy54.0%
Cost1361
\[\begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ \mathbf{if}\;y - z \leq -1 \cdot 10^{+156}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq -5 \cdot 10^{+82}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;y - z \leq -1 \cdot 10^{-9} \lor \neg \left(y - z \leq 2 \cdot 10^{-36}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Accuracy64.7%
Cost980
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := x \cdot \left(1 - y\right)\\ \mathbf{if}\;z \leq -5.9 \cdot 10^{-15}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-293}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-222}:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-76}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-15}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Accuracy77.9%
Cost976
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := x - t \cdot \left(z - y\right)\\ \mathbf{if}\;z \leq -4.35 \cdot 10^{+36}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-293}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.75 \cdot 10^{-273}:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{elif}\;z \leq 1.48 \cdot 10^{-5}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Accuracy78.2%
Cost976
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := x - t \cdot \left(z - y\right)\\ \mathbf{if}\;z \leq -4.4 \cdot 10^{+36}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-293}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.68 \cdot 10^{-273}:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-13}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;x + t_1\\ \end{array} \]
Alternative 7
Accuracy38.4%
Cost852
\[\begin{array}{l} \mathbf{if}\;z \leq -0.0105:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-293}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-218}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-74}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-11}:\\ \;\;\;\;t \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
Alternative 8
Accuracy61.1%
Cost849
\[\begin{array}{l} t_1 := x \cdot \left(1 - y\right)\\ \mathbf{if}\;x \leq -3 \cdot 10^{+121}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -4.9 \cdot 10^{+27}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-11} \lor \neg \left(x \leq 2.25 \cdot 10^{+16}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \end{array} \]
Alternative 9
Accuracy65.5%
Cost716
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -9 \cdot 10^{-19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-76}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-11}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Accuracy100.0%
Cost576
\[x + \left(t - x\right) \cdot \left(y - z\right) \]
Alternative 11
Accuracy41.0%
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{-34}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-37}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t \cdot y\\ \end{array} \]
Alternative 12
Accuracy26.4%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023137 
(FPCore (x y z t)
  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
  :precision binary64

  :herbie-target
  (+ x (+ (* t (- y z)) (* (- x) (- y z))))

  (+ x (* (- y z) (- t x))))