?

Average Error: 0.0 → 0.0
Time: 10.9s
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 \left(-x\right) + \left(y - z\right) \cdot t\right)} \]
  3. Final simplification0.0

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

Alternatives

Alternative 1
Error27.8
Cost1244
\[\begin{array}{l} t_1 := x + x \cdot z\\ t_2 := x + y \cdot t\\ \mathbf{if}\;z \leq -5.4 \cdot 10^{+94}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -8.2 \cdot 10^{+30}:\\ \;\;\;\;-z \cdot t\\ \mathbf{elif}\;z \leq -225000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-58}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;z \leq -3.3 \cdot 10^{-298}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-225}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;z \leq 330:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error26.9
Cost980
\[\begin{array}{l} t_1 := x + x \cdot z\\ \mathbf{if}\;z \leq -2 \cdot 10^{+93}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{+30}:\\ \;\;\;\;-z \cdot t\\ \mathbf{elif}\;z \leq -3600000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4 \cdot 10^{-58}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;z \leq 0.0017:\\ \;\;\;\;x + y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error14.3
Cost976
\[\begin{array}{l} t_1 := x + \left(y - z\right) \cdot t\\ t_2 := x - z \cdot \left(t - x\right)\\ \mathbf{if}\;z \leq -1250:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{-299}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-224}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;z \leq 0.000205:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error10.8
Cost976
\[\begin{array}{l} t_1 := x - z \cdot \left(t - x\right)\\ \mathbf{if}\;z \leq -2.8 \cdot 10^{-58}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-139}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 31000:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+19}:\\ \;\;\;\;x + x \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error38.8
Cost852
\[\begin{array}{l} t_1 := -z \cdot t\\ \mathbf{if}\;z \leq -2 \cdot 10^{+93}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -3.75 \cdot 10^{+30}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3550000000:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -1.42 \cdot 10^{-101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1700000000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
Alternative 6
Error27.2
Cost849
\[\begin{array}{l} \mathbf{if}\;z \leq -3.2 \cdot 10^{+95}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -7 \cdot 10^{+29}:\\ \;\;\;\;-z \cdot t\\ \mathbf{elif}\;z \leq -1000 \lor \neg \left(z \leq 580\right):\\ \;\;\;\;x + x \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot t\\ \end{array} \]
Alternative 7
Error32.2
Cost848
\[\begin{array}{l} t_1 := x \cdot \left(-y\right)\\ t_2 := x + x \cdot z\\ \mathbf{if}\;y \leq -3.4 \cdot 10^{+44}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{-289}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{-251}:\\ \;\;\;\;-z \cdot t\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{+31}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error20.0
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -8.6 \cdot 10^{+15} \lor \neg \left(x \leq 3 \cdot 10^{-84}\right):\\ \;\;\;\;x + x \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \end{array} \]
Alternative 9
Error10.0
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-24} \lor \neg \left(y \leq 310000\right):\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot \left(t - x\right)\\ \end{array} \]
Alternative 10
Error0.0
Cost576
\[x + \left(y - z\right) \cdot \left(t - x\right) \]
Alternative 11
Error38.6
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -1000:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 1700000000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
Alternative 12
Error47.5
Cost64
\[x \]

Error

Reproduce?

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