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

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

Alternatives

Alternative 1
Error31.7
Cost1244
\[\begin{array}{l} t_1 := x + t \cdot y\\ t_2 := x - x \cdot y\\ \mathbf{if}\;y \leq -6.827782913210473 \cdot 10^{+33}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -708598.0734719192:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -7.977988569416837 \cdot 10^{-30}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq 1.2194197020403468 \cdot 10^{-67}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 3.976833428826507 \cdot 10^{-21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 0.06599417889109227:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{+129}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error20.3
Cost1240
\[\begin{array}{l} t_1 := x \cdot \left(z + 1\right)\\ t_2 := x - t \cdot z\\ \mathbf{if}\;y \leq -708598.0734719192:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{elif}\;y \leq -6.9318790672829485 \cdot 10^{-109}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -1.8998875642490576 \cdot 10^{-276}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7.684530991851018 \cdot 10^{-237}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.2194197020403468 \cdot 10^{-67}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.5711684585449842 \cdot 10^{-9}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot y - x \cdot y\\ \end{array} \]
Alternative 3
Error21.7
Cost1112
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := x - x \cdot y\\ \mathbf{if}\;z \leq -35.93358949603736:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.479733302295897 \cdot 10^{-217}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 7.343046838975107 \cdot 10^{-77}:\\ \;\;\;\;x + t \cdot y\\ \mathbf{elif}\;z \leq 2.636286989969004 \cdot 10^{-33}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 2.0680456929474416 \cdot 10^{-5}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq 54.12798883958508:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error20.3
Cost1112
\[\begin{array}{l} t_1 := x \cdot \left(z + 1\right)\\ t_2 := \left(t - x\right) \cdot y\\ t_3 := x - t \cdot z\\ \mathbf{if}\;y \leq -708598.0734719192:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -6.9318790672829485 \cdot 10^{-109}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq -1.8998875642490576 \cdot 10^{-276}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7.684530991851018 \cdot 10^{-237}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 1.2194197020403468 \cdot 10^{-67}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.5711684585449842 \cdot 10^{-9}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error21.6
Cost980
\[\begin{array}{l} t_1 := \left(t - x\right) \cdot y\\ \mathbf{if}\;y \leq -708598.0734719192:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -7.977988569416837 \cdot 10^{-30}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq 1.2194197020403468 \cdot 10^{-67}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 3.976833428826507 \cdot 10^{-21}:\\ \;\;\;\;x + t \cdot y\\ \mathbf{elif}\;y \leq 0.07458389614026488:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error21.6
Cost980
\[\begin{array}{l} t_1 := \left(t - x\right) \cdot y\\ t_2 := t \cdot \left(y - z\right)\\ \mathbf{if}\;y \leq -708598.0734719192:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -6.632601884930541 \cdot 10^{-57}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.2194197020403468 \cdot 10^{-67}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 3.976833428826507 \cdot 10^{-21}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 0.07458389614026488:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error38.3
Cost916
\[\begin{array}{l} t_1 := y \cdot \left(-x\right)\\ \mathbf{if}\;y \leq -6.827782913210473 \cdot 10^{+33}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;y \leq -708598.0734719192:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -7.977988569416837 \cdot 10^{-30}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq 1083.2700441209938:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+136}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot y\\ \end{array} \]
Alternative 8
Error30.6
Cost848
\[\begin{array}{l} t_1 := x - x \cdot y\\ t_2 := x + t \cdot y\\ \mathbf{if}\;x \leq -1.2675431190765383 \cdot 10^{-14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.5 \cdot 10^{-277}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.2525723051908783 \cdot 10^{-210}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;x \leq 5.730392590783861 \cdot 10^{-63}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error39.1
Cost720
\[\begin{array}{l} t_1 := t \cdot \left(-z\right)\\ \mathbf{if}\;z \leq -35.93358949603736:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.636286989969004 \cdot 10^{-33}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 214349.02394708229:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 15164555619337.232:\\ \;\;\;\;t \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
Alternative 10
Error11.8
Cost712
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -1.4362008162118838 \cdot 10^{+29}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.734205528249676 \cdot 10^{-29}:\\ \;\;\;\;x + \left(t - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error10.9
Cost712
\[\begin{array}{l} t_1 := x + z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -2.577223167508378 \cdot 10^{-58}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.734205528249676 \cdot 10^{-29}:\\ \;\;\;\;x + \left(t - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error27.9
Cost584
\[\begin{array}{l} \mathbf{if}\;z \leq -1.4362008162118838 \cdot 10^{+29}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq 2093263379564.7234:\\ \;\;\;\;x + t \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
Alternative 13
Error0.0
Cost576
\[x - \left(t - x\right) \cdot \left(z - y\right) \]
Alternative 14
Error38.1
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -7.977988569416837 \cdot 10^{-30}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;y \leq 1.2194197020403468 \cdot 10^{-67}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t \cdot y\\ \end{array} \]
Alternative 15
Error47.8
Cost64
\[x \]

Error

Reproduce

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