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

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 y around 0 0.1

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

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

    \[\leadsto \left(\frac{x - z}{t} + \frac{y}{t}\right) \cdot 0.5 \]

Alternatives

Alternative 1
Error27.0
Cost1376
\[\begin{array}{l} t_1 := \frac{y \cdot 0.5}{t}\\ t_2 := \frac{x}{\frac{t}{0.5}}\\ t_3 := -0.5 \cdot \frac{z}{t}\\ \mathbf{if}\;x \leq -1.0422830064006472 \cdot 10^{+61}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -8.490185412162121 \cdot 10^{+19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -0.04818218621818409:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -5.963724248589354 \cdot 10^{-183}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -1.6232878753408387 \cdot 10^{-259}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.5710474559422605 \cdot 10^{-291}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 4.539652451897301 \cdot 10^{-212}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.969706393242968 \cdot 10^{-71}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error14.0
Cost976
\[\begin{array}{l} t_1 := -0.5 \cdot \frac{z}{t}\\ t_2 := \frac{x + y}{t \cdot 2}\\ \mathbf{if}\;z \leq -9 \cdot 10^{+168}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.9731126194282375 \cdot 10^{+90}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.8411463389161615 \cdot 10^{+29}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.7045725971702525 \cdot 10^{+57}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error7.4
Cost844
\[\begin{array}{l} t_1 := \frac{x - z}{t} \cdot 0.5\\ \mathbf{if}\;x \leq -1 \cdot 10^{+130}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -23121653.143168956:\\ \;\;\;\;\frac{x + y}{t \cdot 2}\\ \mathbf{elif}\;x \leq -7.649831640126826 \cdot 10^{-67}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y - z}{t}\\ \end{array} \]
Alternative 4
Error9.2
Cost712
\[\begin{array}{l} t_1 := \frac{x - z}{t} \cdot 0.5\\ \mathbf{if}\;z \leq -1.8411463389161615 \cdot 10^{+29}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.9456849078039833 \cdot 10^{+43}:\\ \;\;\;\;\frac{x + y}{t \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error0.3
Cost576
\[\left(x + \left(y - z\right)\right) \cdot \frac{0.5}{t} \]
Alternative 6
Error0.1
Cost576
\[\frac{\left(x + y\right) - z}{t \cdot 2} \]
Alternative 7
Error29.6
Cost452
\[\begin{array}{l} \mathbf{if}\;x \leq -0.04818218621818409:\\ \;\;\;\;\frac{x}{\frac{t}{0.5}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{z}{t}\\ \end{array} \]
Alternative 8
Error41.6
Cost320
\[\frac{x}{\frac{t}{0.5}} \]

Error

Reproduce

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