Average Error: 0.1 → 0.3
Time: 8.3s
Precision: binary64
Cost: 576
\[\frac{\left(x + y\right) - z}{t \cdot 2} \]
\[\left(z - \left(x + y\right)\right) \cdot \frac{-0.5}{t} \]
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
(FPCore (x y z t) :precision binary64 (* (- z (+ x y)) (/ -0.5 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 (z - (x + y)) * (-0.5 / 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 = (z - (x + y)) * ((-0.5d0) / 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 (z - (x + y)) * (-0.5 / t);
}
def code(x, y, z, t):
	return ((x + y) - z) / (t * 2.0)
def code(x, y, z, t):
	return (z - (x + y)) * (-0.5 / 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(z - Float64(x + y)) * Float64(-0.5 / 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 = (z - (x + y)) * (-0.5 / 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[(z - N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(-0.5 / t), $MachinePrecision]), $MachinePrecision]
\frac{\left(x + y\right) - z}{t \cdot 2}
\left(z - \left(x + y\right)\right) \cdot \frac{-0.5}{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. Simplified0.3

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

    [Start]0.1

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

    sub-neg [=>]0.1

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

    +-commutative [=>]0.1

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

    neg-sub0 [=>]0.1

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

    associate-+l- [=>]0.1

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

    sub0-neg [=>]0.1

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

    neg-mul-1 [=>]0.1

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

    *-commutative [=>]0.1

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

    times-frac [=>]0.1

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

    associate-*l/ [=>]0.0

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

    associate-*r/ [<=]0.3

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

    metadata-eval [=>]0.3

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

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

Alternatives

Alternative 1
Error10.3
Cost972
\[\begin{array}{l} t_1 := 0.5 \cdot \frac{y - z}{t}\\ \mathbf{if}\;z \leq -6.8 \cdot 10^{+90}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-40}:\\ \;\;\;\;\frac{-0.5 \cdot \left(z - x\right)}{t}\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+123}:\\ \;\;\;\;0.5 \cdot \left(\frac{y}{t} + \frac{x}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error35.8
Cost849
\[\begin{array}{l} \mathbf{if}\;x \leq -9 \cdot 10^{-20}:\\ \;\;\;\;\frac{x}{\frac{t}{0.5}}\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{-278} \lor \neg \left(x \leq 7.2 \cdot 10^{-240}\right) \land x \leq 5.6 \cdot 10^{-117}:\\ \;\;\;\;\frac{z \cdot -0.5}{t}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y}{t}\\ \end{array} \]
Alternative 3
Error17.5
Cost845
\[\begin{array}{l} \mathbf{if}\;x \leq -3.3 \cdot 10^{+181} \lor \neg \left(x \leq -3.7 \cdot 10^{+172}\right) \land x \leq -2.1 \cdot 10^{+92}:\\ \;\;\;\;\frac{x}{\frac{t}{0.5}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y - z}{t}\\ \end{array} \]
Alternative 4
Error10.5
Cost844
\[\begin{array}{l} t_1 := 0.5 \cdot \frac{y - z}{t}\\ \mathbf{if}\;z \leq -2.9 \cdot 10^{+89}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{-41}:\\ \;\;\;\;\frac{-0.5}{t} \cdot \left(z - x\right)\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+123}:\\ \;\;\;\;\frac{0.5}{t} \cdot \left(x + y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error10.5
Cost844
\[\begin{array}{l} t_1 := 0.5 \cdot \frac{y - z}{t}\\ \mathbf{if}\;z \leq -1.6 \cdot 10^{+89}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -6.8 \cdot 10^{-40}:\\ \;\;\;\;\frac{-0.5 \cdot \left(z - x\right)}{t}\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+124}:\\ \;\;\;\;\frac{0.5}{t} \cdot \left(x + y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error15.5
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 8.5 \cdot 10^{-27}:\\ \;\;\;\;\frac{-0.5}{t} \cdot \left(z - x\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y - z}{t}\\ \end{array} \]
Alternative 7
Error35.7
Cost452
\[\begin{array}{l} \mathbf{if}\;y \leq 7 \cdot 10^{-27}:\\ \;\;\;\;\frac{x}{\frac{t}{0.5}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y}{t}\\ \end{array} \]
Alternative 8
Error40.8
Cost320
\[0.5 \cdot \frac{y}{t} \]

Error

Reproduce

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