Average Error: 0.0 → 0.0
Time: 15.8s
Precision: binary64
Cost: 832
\[x + \left(y - z\right) \cdot \left(t - x\right) \]
\[x + \left(x \cdot \left(z - y\right) + \left(y - z\right) \cdot t\right) \]
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
(FPCore (x y z t) :precision binary64 (+ x (+ (* x (- z y)) (* (- y z) 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 + ((x * (z - y)) + ((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) * (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 + ((x * (z - y)) + ((y - z) * 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 + ((x * (z - y)) + ((y - z) * t));
}
def code(x, y, z, t):
	return x + ((y - z) * (t - x))
def code(x, y, z, t):
	return x + ((x * (z - y)) + ((y - z) * 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(x * Float64(z - y)) + Float64(Float64(y - z) * 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 + ((x * (z - y)) + ((y - z) * 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[(x * N[(z - y), $MachinePrecision]), $MachinePrecision] + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(y - z\right) \cdot \left(t - x\right)
x + \left(x \cdot \left(z - y\right) + \left(y - z\right) \cdot t\right)

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 x + \color{blue}{\left(\left(y - z\right) \cdot t + \left(y - z\right) \cdot \left(-x\right)\right)} \]
  3. Final simplification0.0

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

Alternatives

Alternative 1
Error35.7
Cost1376
\[\begin{array}{l} t_1 := x \cdot \left(1 - y\right)\\ t_2 := z \cdot \left(-t\right)\\ \mathbf{if}\;x \leq -1.355287350729905 \cdot 10^{-26}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.077501522938541 \cdot 10^{-76}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.0767996121179675 \cdot 10^{-130}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -6.002752192702717 \cdot 10^{-227}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.3511552911379865 \cdot 10^{-245}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;x \leq 3.359524365205439 \cdot 10^{-136}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 471.834573214522:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{+128}:\\ \;\;\;\;x \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error36.1
Cost1312
\[\begin{array}{l} t_1 := x \cdot \left(1 - y\right)\\ t_2 := z \cdot \left(-t\right)\\ \mathbf{if}\;t \leq -1.85 \cdot 10^{+78}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -87298855460230.84:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;t \leq -3.6285335236416727 \cdot 10^{-32}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -5.461477990130282 \cdot 10^{-198}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2.204735548068541 \cdot 10^{-244}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;t \leq 5.748772590044842 \cdot 10^{-59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 4.3 \cdot 10^{+102}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 3.2 \cdot 10^{+241}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error40.4
Cost1180
\[\begin{array}{l} t_1 := z \cdot \left(-t\right)\\ t_2 := x \cdot \left(-y\right)\\ \mathbf{if}\;y \leq -5.2 \cdot 10^{+197}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -8.666483375536832 \cdot 10^{-26}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -6.0856926281401236 \cdot 10^{-298}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 7.455619268204242 \cdot 10^{-180}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9.26121301564439 \cdot 10^{-69}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;y \leq 3.21885575913646 \cdot 10^{-55}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{+66}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error24.0
Cost1112
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := x \cdot \left(1 - y\right)\\ t_3 := y \cdot \left(t - x\right)\\ \mathbf{if}\;z \leq -2.1259619406245948 \cdot 10^{+29}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.6270250635975512 \cdot 10^{-73}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -1.5546354866815251 \cdot 10^{-117}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq -7.162361671172863 \cdot 10^{-175}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -7.23952892636311 \cdot 10^{-240}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 8578310779419896:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error24.3
Cost1112
\[\begin{array}{l} t_1 := x \cdot \left(1 - y\right)\\ t_2 := z \cdot \left(x - t\right)\\ t_3 := \left(y - z\right) \cdot t\\ \mathbf{if}\;z \leq -7.007981713237211 \cdot 10^{+35}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -5.190611572170201 \cdot 10^{-157}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -5.111821802260853 \cdot 10^{-175}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.8524732000887693 \cdot 10^{-251}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 4.259444718528736 \cdot 10^{-52}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{+85}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Error17.1
Cost976
\[\begin{array}{l} t_1 := \left(y - z\right) \cdot t\\ t_2 := x - x \cdot \left(y - z\right)\\ \mathbf{if}\;x \leq -8.324210229537707 \cdot 10^{-5}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.077501522938541 \cdot 10^{-76}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.0767996121179675 \cdot 10^{-130}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 3.359524365205439 \cdot 10^{-136}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error40.5
Cost916
\[\begin{array}{l} t_1 := z \cdot \left(-t\right)\\ \mathbf{if}\;y \leq -8.666483375536832 \cdot 10^{-26}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -6.0856926281401236 \cdot 10^{-298}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 7.455619268204242 \cdot 10^{-180}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9.26121301564439 \cdot 10^{-69}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;y \leq 3.21885575913646 \cdot 10^{-55}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
Alternative 8
Error11.2
Cost840
\[\begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -8.666483375536832 \cdot 10^{-26}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7.693514291710784 \cdot 10^{-5}:\\ \;\;\;\;x + \left(x \cdot z - z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error11.2
Cost712
\[\begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -8.666483375536832 \cdot 10^{-26}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7.693514291710784 \cdot 10^{-5}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error39.5
Cost588
\[\begin{array}{l} \mathbf{if}\;y \leq -8.666483375536832 \cdot 10^{-26}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 2.5443568212861814 \cdot 10^{-167}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9.26121301564439 \cdot 10^{-69}:\\ \;\;\;\;x \cdot z\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
Alternative 11
Error22.3
Cost584
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -2.0346825655335534 \cdot 10^{-53}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 8578310779419896:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error0.0
Cost576
\[x + \left(y - z\right) \cdot \left(t - x\right) \]
Alternative 13
Error38.6
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -3783.010294147959:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 2.9522962101091264 \cdot 10^{-23}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
Alternative 14
Error47.6
Cost64
\[x \]

Error

Reproduce

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