?

Average Error: 0.0 → 0.0
Time: 22.0s
Precision: binary64
Cost: 832

?

\[x + \left(y - z\right) \cdot \left(t - x\right) \]
\[t \cdot \left(y - z\right) + \left(\left(z + 1\right) - y\right) \cdot x \]
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
(FPCore (x y z t) :precision binary64 (+ (* t (- y z)) (* (- (+ z 1.0) y) 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 (t * (y - z)) + (((z + 1.0) - y) * 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 = (t * (y - z)) + (((z + 1.0d0) - y) * 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 (t * (y - z)) + (((z + 1.0) - y) * x);
}
def code(x, y, z, t):
	return x + ((y - z) * (t - x))
def code(x, y, z, t):
	return (t * (y - z)) + (((z + 1.0) - y) * 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(Float64(t * Float64(y - z)) + Float64(Float64(Float64(z + 1.0) - y) * x))
end
function tmp = code(x, y, z, t)
	tmp = x + ((y - z) * (t - x));
end
function tmp = code(x, y, z, t)
	tmp = (t * (y - z)) + (((z + 1.0) - y) * 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[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(z + 1.0), $MachinePrecision] - y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
x + \left(y - z\right) \cdot \left(t - x\right)
t \cdot \left(y - z\right) + \left(\left(z + 1\right) - y\right) \cdot x

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. Taylor expanded in x around 0 0.0

    \[\leadsto \color{blue}{t \cdot \left(y - z\right) + \left(1 + -1 \cdot \left(y - z\right)\right) \cdot x} \]
  3. Simplified0.0

    \[\leadsto \color{blue}{t \cdot \left(y - z\right) + \left(\left(z + 1\right) - y\right) \cdot x} \]
    Proof

    [Start]0.0

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

    rational.json-simplify-17 [=>]0.0

    \[ t \cdot \left(y - z\right) + \color{blue}{\left(-1 \cdot \left(y - z\right) - -1\right)} \cdot x \]

    rational.json-simplify-2 [=>]0.0

    \[ t \cdot \left(y - z\right) + \left(\color{blue}{\left(y - z\right) \cdot -1} - -1\right) \cdot x \]

    rational.json-simplify-9 [=>]0.0

    \[ t \cdot \left(y - z\right) + \left(\color{blue}{\left(-\left(y - z\right)\right)} - -1\right) \cdot x \]

    rational.json-simplify-12 [=>]0.0

    \[ t \cdot \left(y - z\right) + \left(\color{blue}{\left(0 - \left(y - z\right)\right)} - -1\right) \cdot x \]

    rational.json-simplify-44 [=>]0.0

    \[ t \cdot \left(y - z\right) + \left(\color{blue}{\left(z - \left(y - 0\right)\right)} - -1\right) \cdot x \]

    rational.json-simplify-5 [=>]0.0

    \[ t \cdot \left(y - z\right) + \left(\left(z - \color{blue}{y}\right) - -1\right) \cdot x \]

    rational.json-simplify-5 [<=]0.0

    \[ t \cdot \left(y - z\right) + \left(\left(z - y\right) - -1\right) \cdot \color{blue}{\left(x - 0\right)} \]

    metadata-eval [<=]0.0

    \[ t \cdot \left(y - z\right) + \left(\left(z - y\right) - -1\right) \cdot \left(x - \color{blue}{\left(-1 - -1\right)}\right) \]

    rational.json-simplify-44 [<=]13.3

    \[ t \cdot \left(y - z\right) + \left(\left(z - y\right) - -1\right) \cdot \color{blue}{\left(-1 - \left(-1 - x\right)\right)} \]

    rational.json-simplify-52 [<=]13.3

    \[ t \cdot \left(y - z\right) + \color{blue}{\left(\left(-1 - x\right) + 1\right) \cdot \left(-1 - \left(z - y\right)\right)} \]

    rational.json-simplify-44 [<=]13.3

    \[ t \cdot \left(y - z\right) + \left(\left(-1 - x\right) + 1\right) \cdot \color{blue}{\left(y - \left(z - -1\right)\right)} \]

    rational.json-simplify-17 [<=]13.3

    \[ t \cdot \left(y - z\right) + \left(\left(-1 - x\right) + 1\right) \cdot \left(y - \color{blue}{\left(1 + z\right)}\right) \]

    rational.json-simplify-52 [=>]13.3

    \[ t \cdot \left(y - z\right) + \color{blue}{\left(\left(1 + z\right) - y\right) \cdot \left(-1 - \left(-1 - x\right)\right)} \]

    rational.json-simplify-1 [=>]13.3

    \[ t \cdot \left(y - z\right) + \left(\color{blue}{\left(z + 1\right)} - y\right) \cdot \left(-1 - \left(-1 - x\right)\right) \]

    rational.json-simplify-44 [=>]0.0

    \[ t \cdot \left(y - z\right) + \left(\left(z + 1\right) - y\right) \cdot \color{blue}{\left(x - \left(-1 - -1\right)\right)} \]

    metadata-eval [=>]0.0

    \[ t \cdot \left(y - z\right) + \left(\left(z + 1\right) - y\right) \cdot \left(x - \color{blue}{0}\right) \]

    rational.json-simplify-5 [=>]0.0

    \[ t \cdot \left(y - z\right) + \left(\left(z + 1\right) - y\right) \cdot \color{blue}{x} \]
  4. Final simplification0.0

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

Alternatives

Alternative 1
Error29.0
Cost2140
\[\begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ t_2 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y - z \leq -1 \cdot 10^{+107}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq -1 \cdot 10^{+74}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq -2 \cdot 10^{-24}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq 0.002:\\ \;\;\;\;x\\ \mathbf{elif}\;y - z \leq 10^{+137}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq 5 \cdot 10^{+221}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq 2 \cdot 10^{+251}:\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error26.2
Cost1904
\[\begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ t_2 := z \cdot \left(x - t\right)\\ t_3 := y \cdot \left(t - x\right)\\ \mathbf{if}\;z \leq -2.5 \cdot 10^{+22}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -9.2 \cdot 10^{-79}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-129}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -9 \cdot 10^{-197}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{-218}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{-305}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-263}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-157}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-95}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-84}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{-51}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{+35}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error30.2
Cost1816
\[\begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ t_2 := y \cdot \left(-x\right)\\ \mathbf{if}\;y - z \leq -2 \cdot 10^{+162}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq -5 \cdot 10^{+112}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y - z \leq -1 \cdot 10^{-26}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq 0.002:\\ \;\;\;\;x\\ \mathbf{elif}\;y - z \leq 5 \cdot 10^{+221}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y - z \leq 2 \cdot 10^{+251}:\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error39.4
Cost1312
\[\begin{array}{l} t_1 := y \cdot \left(-x\right)\\ \mathbf{if}\;y \leq -6.2 \cdot 10^{+112}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{+48}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -55000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.6 \cdot 10^{-24}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 10^{-201}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-132}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;y \leq 0.00215:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+227}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error39.6
Cost1180
\[\begin{array}{l} t_1 := t \cdot \left(-z\right)\\ \mathbf{if}\;z \leq -5.5 \cdot 10^{+141}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{+106}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -3.05 \cdot 10^{-218}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-284}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-95}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2 \cdot 10^{+35}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error19.8
Cost1112
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := y \cdot t + x\\ \mathbf{if}\;z \leq -1.55 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{-256}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 2.95 \cdot 10^{-248}:\\ \;\;\;\;y \cdot \left(-x\right) + x\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-78}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 9.2 \cdot 10^{-53}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+35}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error15.0
Cost976
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := x + t \cdot \left(y - z\right)\\ \mathbf{if}\;z \leq -6.4 \cdot 10^{+21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-256}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-247}:\\ \;\;\;\;y \cdot \left(-x\right) + x\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+54}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error11.2
Cost976
\[\begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -5.4 \cdot 10^{-15}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-39}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{+51}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+68}:\\ \;\;\;\;x + \left(z - y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error10.8
Cost976
\[\begin{array}{l} t_1 := y \cdot \left(t - x\right) + x\\ \mathbf{if}\;y \leq -5.3 \cdot 10^{-15}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-36}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+49}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \mathbf{elif}\;y \leq 7.4 \cdot 10^{+65}:\\ \;\;\;\;x + \left(z - y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error18.0
Cost912
\[\begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ t_2 := x + t \cdot \left(-z\right)\\ \mathbf{if}\;y \leq -1.9 \cdot 10^{-24}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{-201}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.08 \cdot 10^{-156}:\\ \;\;\;\;z \cdot x + x\\ \mathbf{elif}\;y \leq 820:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error39.5
Cost852
\[\begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -3.1 \cdot 10^{-218}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -5 \cdot 10^{-283}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{-95}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+35}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
Alternative 12
Error19.0
Cost848
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -6.8 \cdot 10^{+21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-79}:\\ \;\;\;\;y \cdot t + x\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-51}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 2 \cdot 10^{+35}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error11.3
Cost848
\[\begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ t_2 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -5.4 \cdot 10^{-15}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{-40}:\\ \;\;\;\;x + t_1\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{+50}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \mathbf{elif}\;y \leq 3.55 \cdot 10^{+65}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 14
Error0.0
Cost576
\[x + \left(y - z\right) \cdot \left(t - x\right) \]
Alternative 15
Error38.2
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -1.06 \cdot 10^{-26}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 0.049:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
Alternative 16
Error47.2
Cost64
\[x \]

Error

Reproduce?

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