?

Average Error: 0.0 → 0.0
Time: 16.5s
Precision: binary64
Cost: 832

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right) \]

Derivation?

  1. Initial program 0.0

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

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

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

Alternatives

Alternative 1
Error25.3
Cost2036
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := t \cdot \left(y - z\right)\\ t_3 := y \cdot \left(t - x\right)\\ t_4 := \left(1 + z\right) \cdot x\\ \mathbf{if}\;y \leq -5.5 \cdot 10^{-51}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq -1.2 \cdot 10^{-93}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;y \leq -5.6 \cdot 10^{-117}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -2.05 \cdot 10^{-143}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{-157}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -3.2 \cdot 10^{-272}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{-230}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-143}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-74}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;y \leq 1.46 \cdot 10^{-28}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-15}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+37}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+160}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 2
Error41.8
Cost1444
\[\begin{array}{l} t_1 := t \cdot \left(-z\right)\\ \mathbf{if}\;y \leq -1.4 \cdot 10^{+138}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{-51}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -1.3 \cdot 10^{-109}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -6.8 \cdot 10^{-263}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-228}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.26 \cdot 10^{-143}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{-102}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{+55}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{+138}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
Alternative 3
Error40.0
Cost1180
\[\begin{array}{l} t_1 := t \cdot \left(-z\right)\\ \mathbf{if}\;z \leq -1.6 \cdot 10^{+100}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{-105}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -5.3 \cdot 10^{-220}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-287}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-156}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-23}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error29.3
Cost1112
\[\begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ t_2 := t \cdot \left(y - z\right)\\ \mathbf{if}\;y \leq -580:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-270}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{-230}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4.05 \cdot 10^{-143}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-101}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+160}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error26.4
Cost1112
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := y \cdot \left(t - x\right)\\ \mathbf{if}\;z \leq -2.05 \cdot 10^{-57}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{-227}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -8.7 \cdot 10^{-290}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-73}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-28}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-17}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error40.1
Cost984
\[\begin{array}{l} \mathbf{if}\;z \leq -0.98:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -3.1 \cdot 10^{-106}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{-216}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -8.2 \cdot 10^{-287}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{-154}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
Alternative 7
Error29.1
Cost716
\[\begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{+44}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.55 \cdot 10^{-44}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{+111}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error13.5
Cost712
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -3.15:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6800:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error11.8
Cost712
\[\begin{array}{l} t_1 := x + t \cdot \left(y - z\right)\\ \mathbf{if}\;t \leq -9.2 \cdot 10^{-71}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{-104}:\\ \;\;\;\;x + x \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error10.6
Cost712
\[\begin{array}{l} t_1 := x + z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -2.5 \cdot 10^{-57}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-18}:\\ \;\;\;\;y \cdot \left(t - x\right) + x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error18.3
Cost584
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -2.6 \cdot 10^{-36}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-23}:\\ \;\;\;\;y \cdot t + x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error0.0
Cost576
\[x + \left(y - z\right) \cdot \left(t - x\right) \]
Alternative 13
Error38.9
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-51}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 1.62 \cdot 10^{-100}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
Alternative 14
Error47.7
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023090 
(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))))