Yesterday, nobody contributed anything.  :-(
The official answer is: floor(2 * x - 4 * x ^ 2) / floor(-x)