Average Error: 0.1 → 0.1
Time: 7.8s
Precision: binary64
Cost: 832
\[\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
Error35.2
Cost1112
\[\begin{array}{l} t_1 := \frac{0.5 \cdot y}{t}\\ t_2 := z \cdot \frac{-0.5}{t}\\ \mathbf{if}\;x \leq -1.8687920500254332 \cdot 10^{-19}:\\ \;\;\;\;0.5 \cdot \frac{x}{t}\\ \mathbf{elif}\;x \leq -4.8304259875799976 \cdot 10^{-36}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -5.44809706222954 \cdot 10^{-135}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.436354679616663 \cdot 10^{-298}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.769209405228054 \cdot 10^{-262}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.792073951147582 \cdot 10^{-133}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error35.2
Cost1112
\[\begin{array}{l} t_1 := \frac{0.5 \cdot y}{t}\\ t_2 := -0.5 \cdot \frac{z}{t}\\ \mathbf{if}\;x \leq -1.8687920500254332 \cdot 10^{-19}:\\ \;\;\;\;0.5 \cdot \frac{x}{t}\\ \mathbf{elif}\;x \leq -4.8304259875799976 \cdot 10^{-36}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -5.44809706222954 \cdot 10^{-135}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.436354679616663 \cdot 10^{-298}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.769209405228054 \cdot 10^{-262}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.792073951147582 \cdot 10^{-133}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error14.7
Cost712
\[\begin{array}{l} t_1 := -0.5 \cdot \frac{z}{t}\\ \mathbf{if}\;z \leq -3.1838753574723133 \cdot 10^{+93}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.723536750205161 \cdot 10^{-24}:\\ \;\;\;\;\frac{0.5}{t} \cdot \left(y + x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error9.5
Cost712
\[\begin{array}{l} t_1 := 0.5 \cdot \frac{x - z}{t}\\ \mathbf{if}\;z \leq -287397808677.0836:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.1944818338294234 \cdot 10^{-40}:\\ \;\;\;\;\frac{0.5}{t} \cdot \left(y + x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error16.2
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -1.111706429061843 \cdot 10^{-74}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{t}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y - z}{t}\\ \end{array} \]
Alternative 6
Error0.3
Cost576
\[\left(\left(y - z\right) + x\right) \cdot \frac{0.5}{t} \]
Alternative 7
Error0.1
Cost576
\[\frac{\left(y + x\right) - z}{t \cdot 2} \]
Alternative 8
Error36.7
Cost452
\[\begin{array}{l} \mathbf{if}\;x \leq -2.1334271025931996 \cdot 10^{-78}:\\ \;\;\;\;\frac{0.5}{\frac{t}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot y}{t}\\ \end{array} \]
Alternative 9
Error36.7
Cost452
\[\begin{array}{l} \mathbf{if}\;x \leq -2.1334271025931996 \cdot 10^{-78}:\\ \;\;\;\;x \cdot \frac{0.5}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot y}{t}\\ \end{array} \]
Alternative 10
Error36.6
Cost452
\[\begin{array}{l} \mathbf{if}\;x \leq -2.1334271025931996 \cdot 10^{-78}:\\ \;\;\;\;0.5 \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot y}{t}\\ \end{array} \]
Alternative 11
Error41.4
Cost320
\[\frac{0.5 \cdot y}{t} \]

Error

Reproduce

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