Average Error: 0.0 → 0.0
Time: 13.0s
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
Error25.5
Cost2140
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := \left(y - z\right) \cdot t\\ \mathbf{if}\;y - z \leq -2 \cdot 10^{+195}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq -2 \cdot 10^{+149}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;y - z \leq -2 \cdot 10^{+71}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq -20000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq 2 \cdot 10^{-19}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y - z \leq 2 \cdot 10^{+85}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq 10^{+205}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error28.1
Cost1112
\[\begin{array}{l} t_1 := x + x \cdot z\\ \mathbf{if}\;y \leq -7.5 \cdot 10^{+192}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -3.55 \cdot 10^{+149}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq -8900670098.279684:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -3.0508528823679313 \cdot 10^{-74}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.13194446414176 \cdot 10^{-120}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 1.599115644565482 \cdot 10^{-13}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
Alternative 3
Error27.8
Cost848
\[\begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{+192}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -3.55 \cdot 10^{+149}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq -8900670098.279684:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 4.65269669112015 \cdot 10^{-13}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
Alternative 4
Error18.6
Cost848
\[\begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ t_2 := x + x \cdot z\\ \mathbf{if}\;y \leq -534665990.5310623:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.0508528823679313 \cdot 10^{-74}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 4.13194446414176 \cdot 10^{-120}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 1.599115644565482 \cdot 10^{-13}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error39.6
Cost784
\[\begin{array}{l} t_1 := z \cdot \left(-t\right)\\ \mathbf{if}\;z \leq -7.305811136329018 \cdot 10^{-41}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.4776924583723256 \cdot 10^{-276}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.3340215029808704 \cdot 10^{-169}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 1.5301848009521918 \cdot 10^{-13}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error10.9
Cost712
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -0.0014763663795829501:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 0.006073290752582462:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error10.6
Cost712
\[\begin{array}{l} t_1 := x - z \cdot \left(t - x\right)\\ \mathbf{if}\;z \leq -2.955912710389506 \cdot 10^{-32}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 0.006073290752582462:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error31.8
Cost584
\[\begin{array}{l} t_1 := z \cdot \left(-t\right)\\ \mathbf{if}\;z \leq -0.0001901776526265197:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1937459230.3163033:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error21.7
Cost584
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -0.0001901776526265197:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 0.0013443158002171215:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error0.0
Cost576
\[x + \left(y - z\right) \cdot \left(t - x\right) \]
Alternative 11
Error38.7
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -1.9118805589771033 \cdot 10^{-63}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 1.769460530747938 \cdot 10^{-19}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
Alternative 12
Error47.7
Cost64
\[x \]

Error

Reproduce

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