?

Average Error: 0.1 → 0.1
Time: 9.7s
Precision: binary64
Cost: 704

?

\[ \begin{array}{c}[x, y] = \mathsf{sort}([x, y])\\ \end{array} \]
\[\frac{\left(x + y\right) - z}{t \cdot 2} \]
\[0.5 \cdot \left(\frac{x - z}{t} + \frac{y}{t}\right) \]
(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
(FPCore (x y z t) :precision binary64 (* 0.5 (+ (/ (- x z) t) (/ y 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 * (((x - z) / t) + (y / 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 * (((x - z) / t) + (y / 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 * (((x - z) / t) + (y / t));
}
def code(x, y, z, t):
	return ((x + y) - z) / (t * 2.0)
def code(x, y, z, t):
	return 0.5 * (((x - z) / t) + (y / 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(0.5 * Float64(Float64(Float64(x - z) / t) + Float64(y / 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 * (((x - z) / t) + (y / 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[(0.5 * N[(N[(N[(x - z), $MachinePrecision] / t), $MachinePrecision] + N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(x + y\right) - z}{t \cdot 2}
0.5 \cdot \left(\frac{x - z}{t} + \frac{y}{t}\right)

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. Simplified0.1

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

    [Start]0.1

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

    rational_best.json-simplify-47 [=>]0.1

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

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

Alternatives

Alternative 1
Error26.6
Cost1112
\[\begin{array}{l} t_1 := \frac{y}{t \cdot 2}\\ t_2 := \frac{x}{t \cdot 2}\\ t_3 := \frac{z}{t} \cdot -0.5\\ \mathbf{if}\;x \leq -5.3 \cdot 10^{+78}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{+26}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -1.28 \cdot 10^{-5}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-37}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -2.45 \cdot 10^{-73}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.22 \cdot 10^{-225}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error30.5
Cost980
\[\begin{array}{l} t_1 := \frac{x}{t \cdot 2}\\ t_2 := \frac{z}{t} \cdot -0.5\\ \mathbf{if}\;x \leq -1.7 \cdot 10^{+79}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.3 \cdot 10^{+24}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -9:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -8.5 \cdot 10^{-37}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.65 \cdot 10^{-73}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error6.8
Cost844
\[\begin{array}{l} t_1 := \frac{x - z}{t \cdot 2}\\ \mathbf{if}\;x \leq -2.6 \cdot 10^{+26}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -5.9 \cdot 10^{-7}:\\ \;\;\;\;\frac{y + x}{t \cdot 2}\\ \mathbf{elif}\;x \leq -5.6 \cdot 10^{-74}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{y - z}{t \cdot 2}\\ \end{array} \]
Alternative 4
Error13.1
Cost712
\[\begin{array}{l} t_1 := \frac{z}{t} \cdot -0.5\\ \mathbf{if}\;z \leq -1.56 \cdot 10^{+108}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{+101}:\\ \;\;\;\;\frac{y + x}{t \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error8.8
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq 7.4 \cdot 10^{-19}:\\ \;\;\;\;\frac{x - z}{t \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{y + x}{t \cdot 2}\\ \end{array} \]
Alternative 6
Error0.1
Cost576
\[\frac{\left(x + y\right) - z}{t \cdot 2} \]
Alternative 7
Error41.1
Cost320
\[\frac{z}{t} \cdot -0.5 \]

Error

Reproduce?

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