(FPCore (x y z t) :precision binary64 (/ (- (+ x y) z) (* t 2.0)))
(FPCore (x y z t) :precision binary64 (+ (* 0.5 (/ x t)) (* 0.5 (- (/ y t) (/ z 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 / t)) + (0.5 * ((y / t) - (z / 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 / t)) + (0.5d0 * ((y / t) - (z / 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 / t)) + (0.5 * ((y / t) - (z / t)));
}
def code(x, y, z, t): return ((x + y) - z) / (t * 2.0)
def code(x, y, z, t): return (0.5 * (x / t)) + (0.5 * ((y / t) - (z / 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(x / t)) + Float64(0.5 * Float64(Float64(y / t) - Float64(z / 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 / t)) + (0.5 * ((y / t) - (z / 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[(x / t), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(y / t), $MachinePrecision] - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(x + y\right) - z}{t \cdot 2}
0.5 \cdot \frac{x}{t} + 0.5 \cdot \left(\frac{y}{t} - \frac{z}{t}\right)
Results
Initial program 0.1
Taylor expanded in x around inf 0.1
Final simplification0.1
herbie shell --seed 2022210
(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)))