Is there a simple formula to express the following "adversarial" rounding function?
$$f(x) = \begin{cases} \lfloor x \rfloor & \text{if } | x - \lfloor x \rfloor | \ge | x - \lceil x \rceil | \\ \lceil x \rceil & \text{otherwise} \end{cases}$$
The simplest I could come up with is the following, which involves 5 operations:
$$f(x) = \lfloor x \rfloor + \lfloor ( \lceil x \rceil - x ) \rceil$$
Behavior for a fractional part of 0.5 may be arbitrarily chosen.
A solution to rounding to second-nearest integer with $5$ operations, but one fewer rounding: $$f(x) = \lfloor (2\times \lfloor x \rfloor + 1 - x)\rceil$$