Back to the Problem
Case analysis on the signs of X and Y, with the zero cases first.
Complexity: O(1)