?

Average Error: 0.0 → 0.0
Time: 29.2s
Precision: binary64
Cost: 576

?

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

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

Alternatives

Alternative 1
Error24.8
Cost2464
\[\begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ t_2 := \left(z + \left(-y\right)\right) \cdot x\\ \mathbf{if}\;y - z \leq -5 \cdot 10^{+222}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq -5 \cdot 10^{+148}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq -5 \cdot 10^{+107}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq -2 \cdot 10^{+77}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq -4 \cdot 10^{+14}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq 0.005:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;y - z \leq 2 \cdot 10^{+103}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq 2 \cdot 10^{+163}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error24.8
Cost2464
\[\begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ t_2 := \left(z + \left(-y\right)\right) \cdot x\\ \mathbf{if}\;y - z \leq -5 \cdot 10^{+222}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq -5 \cdot 10^{+148}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq -5 \cdot 10^{+107}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq -2 \cdot 10^{+77}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq -2 \cdot 10^{+24}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq 0.005:\\ \;\;\;\;x + t \cdot \left(-z\right)\\ \mathbf{elif}\;y - z \leq 2 \cdot 10^{+103}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq 2 \cdot 10^{+163}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error30.6
Cost1880
\[\begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ \mathbf{if}\;y - z \leq -2 \cdot 10^{+77}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq -2 \cdot 10^{+24}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;y - z \leq -2 \cdot 10^{-5}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq 0.005:\\ \;\;\;\;x\\ \mathbf{elif}\;y - z \leq 2 \cdot 10^{+103}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq 2 \cdot 10^{+163}:\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error41.6
Cost1444
\[\begin{array}{l} t_1 := t \cdot \left(-z\right)\\ \mathbf{if}\;x \leq -1.42 \cdot 10^{+202}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.55 \cdot 10^{+158}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;x \leq -4.8 \cdot 10^{-31}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -9.2 \cdot 10^{-202}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;x \leq -1.5 \cdot 10^{-220}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-294}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{-308}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.85 \cdot 10^{-142}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-30}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error38.3
Cost1312
\[\begin{array}{l} t_1 := y \cdot \left(-x\right)\\ \mathbf{if}\;y \leq -4.6 \cdot 10^{+217}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -5 \cdot 10^{+76}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -1:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-292}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-284}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq 0.0028:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+106}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{+217}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
Alternative 6
Error18.1
Cost976
\[\begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ t_2 := x \cdot \left(z - \left(y - 1\right)\right)\\ \mathbf{if}\;x \leq -1.65 \cdot 10^{-100}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{-185}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{-64}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.02 \cdot 10^{-29}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error13.9
Cost976
\[\begin{array}{l} t_1 := x + t \cdot \left(y - z\right)\\ t_2 := x \cdot \left(z - \left(y - 1\right)\right)\\ \mathbf{if}\;x \leq -7.5 \cdot 10^{-15}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.1 \cdot 10^{-47}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -6.4 \cdot 10^{-105}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{-29}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 8
Error22.0
Cost848
\[\begin{array}{l} t_1 := \left(t - x\right) \cdot y\\ t_2 := \left(1 + z\right) \cdot x\\ \mathbf{if}\;y \leq -1.6 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -7 \cdot 10^{-295}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{-298}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq 2500000:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error22.0
Cost848
\[\begin{array}{l} t_1 := \left(t - x\right) \cdot y\\ \mathbf{if}\;y \leq -1.42 \cdot 10^{-5}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -6.6 \cdot 10^{-295}:\\ \;\;\;\;z \cdot x + x\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{-299}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq 2500000:\\ \;\;\;\;\left(1 + z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error10.4
Cost712
\[\begin{array}{l} t_1 := \left(t - x\right) \cdot y\\ \mathbf{if}\;y \leq -3.1:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2500000:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error10.2
Cost712
\[\begin{array}{l} t_1 := y \cdot \left(t - x\right) + x\\ \mathbf{if}\;y \leq -2.55 \cdot 10^{-5}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2500000:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error23.7
Cost584
\[\begin{array}{l} t_1 := \left(1 + z\right) \cdot x\\ \mathbf{if}\;x \leq -6.5 \cdot 10^{-33}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.05 \cdot 10^{-28}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error23.9
Cost584
\[\begin{array}{l} t_1 := \left(1 - y\right) \cdot x\\ \mathbf{if}\;x \leq -1.45 \cdot 10^{-68}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{-30}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Error38.3
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -4.7 \cdot 10^{-7}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 0.0029:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
Alternative 15
Error47.7
Cost64
\[x \]

Error

Reproduce?

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