The function takes a real number x and doubles it, except for inputs of -1 and -2, which are halved.

