?

Average Error: 0.0 → 0.0
Time: 8.4s
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{y - z}{t} + \frac{x}{t}\right) \]
(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) (/ 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) + (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) + (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) + (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) + (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(0.5 * Float64(Float64(Float64(y - z) / t) + 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) + (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[(0.5 * N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] + N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(x + y\right) - z}{t \cdot 2}
0.5 \cdot \left(\frac{y - z}{t} + \frac{x}{t}\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{0.5 \cdot \frac{y - z}{t} + 0.5 \cdot \frac{x}{t}} \]
  3. Simplified0.0

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

    [Start]0.0

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

    rational.json-simplify-1 [=>]0.0

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

    rational.json-simplify-2 [=>]0.0

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

    rational.json-simplify-51 [=>]0.0

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

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

Alternatives

Alternative 1
Error24.6
Cost1112
\[\begin{array}{l} t_1 := 0.5 \cdot \frac{x}{t}\\ t_2 := 0.5 \cdot \frac{y}{t}\\ t_3 := \frac{z}{t} \cdot -0.5\\ \mathbf{if}\;x \leq -5.8 \cdot 10^{+25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.35 \cdot 10^{-18}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -7 \cdot 10^{-48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.25 \cdot 10^{-289}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{-307}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-269}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error15.3
Cost976
\[\begin{array}{l} t_1 := \frac{z}{t} \cdot -0.5\\ t_2 := 0.5 \cdot \frac{y + x}{t}\\ \mathbf{if}\;z \leq -1.1 \cdot 10^{+232}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{+104}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -3.15 \cdot 10^{+43}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{+141}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error9.3
Cost712
\[\begin{array}{l} t_1 := 0.5 \cdot \frac{x - z}{t}\\ \mathbf{if}\;z \leq -8.5 \cdot 10^{+19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7.8 \cdot 10^{+60}:\\ \;\;\;\;0.5 \cdot \frac{y + x}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error6.4
Cost708
\[\begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{-40}:\\ \;\;\;\;0.5 \cdot \left(\frac{x}{t} - \frac{z}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y - z}{t}\\ \end{array} \]
Alternative 5
Error6.4
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{-40}:\\ \;\;\;\;0.5 \cdot \frac{x - z}{t}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y - z}{t}\\ \end{array} \]
Alternative 6
Error0.3
Cost576
\[\frac{0.5}{t} \cdot \left(x + \left(y - z\right)\right) \]
Alternative 7
Error0.0
Cost576
\[\frac{\left(x + y\right) - z}{t \cdot 2} \]
Alternative 8
Error26.5
Cost452
\[\begin{array}{l} \mathbf{if}\;y \leq 1.45 \cdot 10^{-41}:\\ \;\;\;\;0.5 \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{y}{t}\\ \end{array} \]
Alternative 9
Error40.9
Cost320
\[0.5 \cdot \frac{x}{t} \]

Error

Reproduce?

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