Average Error: 0.1 → 0.1
Time: 8.5s
Precision: binary64
Cost: 832
\[ \begin{array}{c}[x, y] = \mathsf{sort}([x, y])\\ \end{array} \]
\[\frac{\left(x + y\right) - z}{t \cdot 2} \]
\[0.5 \cdot \frac{y - z}{t} + 0.5 \cdot \frac{x}{t} \]
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
(FPCore (x y z t)
 :precision binary64
 (+ (* 0.5 (/ (- y z) t)) (* 0.5 (/ x t))))
double code(double x, double y, double z, double t) {
	return ((x + y) - z) / (t * 2.0);
}
double code(double x, double y, double z, double t) {
	return (0.5 * ((y - z) / t)) + (0.5 * (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 * 2.0d0)
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 = (0.5d0 * ((y - z) / t)) + (0.5d0 * (x / t))
end function
public static double code(double x, double y, double z, double t) {
	return ((x + y) - z) / (t * 2.0);
}
public static double code(double x, double y, double z, double t) {
	return (0.5 * ((y - z) / t)) + (0.5 * (x / t));
}
def code(x, y, z, t):
	return ((x + y) - z) / (t * 2.0)
def code(x, y, z, t):
	return (0.5 * ((y - z) / t)) + (0.5 * (x / t))
function code(x, y, z, t)
	return Float64(Float64(Float64(x + y) - z) / Float64(t * 2.0))
end
function code(x, y, z, t)
	return Float64(Float64(0.5 * Float64(Float64(y - z) / t)) + Float64(0.5 * Float64(x / t)))
end
function tmp = code(x, y, z, t)
	tmp = ((x + y) - z) / (t * 2.0);
end
function tmp = code(x, y, z, t)
	tmp = (0.5 * ((y - z) / t)) + (0.5 * (x / t));
end
code[x_, y_, z_, t_] := N[(N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision] / N[(t * 2.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(0.5 * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(x + y\right) - z}{t \cdot 2}
0.5 \cdot \frac{y - z}{t} + 0.5 \cdot \frac{x}{t}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[\frac{\left(x + y\right) - z}{t \cdot 2} \]
  2. Taylor expanded in x around 0 0.1

    \[\leadsto \color{blue}{0.5 \cdot \frac{y - z}{t} + 0.5 \cdot \frac{x}{t}} \]
  3. Final simplification0.1

    \[\leadsto 0.5 \cdot \frac{y - z}{t} + 0.5 \cdot \frac{x}{t} \]

Alternatives

Alternative 1
Error26.4
Cost1244
\[\begin{array}{l} t_1 := z \cdot \frac{-0.5}{t}\\ t_2 := y \cdot \frac{0.5}{t}\\ \mathbf{if}\;x \leq -2.7459369957840644 \cdot 10^{-40}:\\ \;\;\;\;0.5 \cdot \frac{x}{t}\\ \mathbf{elif}\;x \leq -6.526256346597655 \cdot 10^{-80}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -6.741720364843608 \cdot 10^{-103}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.2384659789149964 \cdot 10^{-141}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -4.337777309831154 \cdot 10^{-259}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.4456307688211523 \cdot 10^{-302}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.5139684045868965 \cdot 10^{-226}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error26.4
Cost1244
\[\begin{array}{l} t_1 := z \cdot \frac{-0.5}{t}\\ t_2 := \frac{0.5 \cdot y}{t}\\ \mathbf{if}\;x \leq -2.7459369957840644 \cdot 10^{-40}:\\ \;\;\;\;0.5 \cdot \frac{x}{t}\\ \mathbf{elif}\;x \leq -6.526256346597655 \cdot 10^{-80}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -6.741720364843608 \cdot 10^{-103}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.2384659789149964 \cdot 10^{-141}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -4.337777309831154 \cdot 10^{-259}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.4456307688211523 \cdot 10^{-302}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.5139684045868965 \cdot 10^{-226}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error26.3
Cost1244
\[\begin{array}{l} t_1 := -0.5 \cdot \frac{z}{t}\\ t_2 := \frac{0.5 \cdot y}{t}\\ \mathbf{if}\;x \leq -2.7459369957840644 \cdot 10^{-40}:\\ \;\;\;\;0.5 \cdot \frac{x}{t}\\ \mathbf{elif}\;x \leq -6.526256346597655 \cdot 10^{-80}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -6.741720364843608 \cdot 10^{-103}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.2384659789149964 \cdot 10^{-141}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -4.337777309831154 \cdot 10^{-259}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.4456307688211523 \cdot 10^{-302}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.5139684045868965 \cdot 10^{-226}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error11.9
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 1.6721304867145286 \cdot 10^{+96}:\\ \;\;\;\;\frac{0.5}{t} \cdot \left(x - z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot y}{t}\\ \end{array} \]
Alternative 5
Error11.7
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 1.6721304867145286 \cdot 10^{+96}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot y}{t}\\ \end{array} \]
Alternative 6
Error6.3
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -4.8883363713880545 \cdot 10^{-31}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{t}\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{0.5}{t}\\ \end{array} \]
Alternative 7
Error6.3
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -6.588970868030848 \cdot 10^{-35}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{\frac{t}{y - z}}\\ \end{array} \]
Alternative 8
Error6.2
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -4.8883363713880545 \cdot 10^{-31}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{t}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y - z}{t}\\ \end{array} \]
Alternative 9
Error0.3
Cost576
\[\left(\left(y - z\right) + x\right) \cdot \frac{0.5}{t} \]
Alternative 10
Error0.1
Cost576
\[\frac{\left(y + x\right) - z}{t \cdot 2} \]
Alternative 11
Error27.3
Cost452
\[\begin{array}{l} \mathbf{if}\;x \leq -2.7459369957840644 \cdot 10^{-40}:\\ \;\;\;\;\frac{0.5}{\frac{t}{x}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{0.5}{t}\\ \end{array} \]
Alternative 12
Error27.3
Cost452
\[\begin{array}{l} \mathbf{if}\;x \leq -2.7459369957840644 \cdot 10^{-40}:\\ \;\;\;\;0.5 \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{0.5}{t}\\ \end{array} \]
Alternative 13
Error41.0
Cost320
\[y \cdot \frac{0.5}{t} \]

Error

Reproduce

herbie shell --seed 2022295 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, B"
  :precision binary64
  (/ (- (+ x y) z) (* t 2.0)))