"Integer average" of two integer numbers Suppose two arbitrary integer numbers $a$ and $b$. I'm looking for some function $f(a,b)$ with the following properties:


*

*$f(a,b)\in\mathbb{Z}$.

*$f(a,a)=a$.

*$f(a,b)=f(b,a)$.

*$\min\{a,b\}< f(a,b)< \max\{a,b\}$, accepting "$\leq$" if $a$ and $b$ are consecutive ($a=b\pm 1$).


Any example of such a function? 
Improvement: Any solution avoiding "floor/ceiling-like" functions?

I would use "scientific rounding" (round to even) on the arithmetic mean.  So if $(a+b)/2$ is an integer, use that, otherwise use the even integer out of $(a+b+1)/2$ and $(a+b-1)/2$.  So that would likely be something like
$$\left\lfloor a+b+1\over4\right\rfloor + \left\lceil a+b-1\over4\right\rceil$$
The advantage of this kind of rounding is that it is overall unbiased while preferredly rounding to points of greater stability, possibly reducing the amount of followup errors with repeated operations since averaging two values calculated using the "round to even" tie-breaking will have an exact result not needing another tie breaker.
