There's a small flaw with the algoritm mentioned in your page. The problem is how is treats negative numbers. If you simply stick a negative sign in front of the number, that's fine. However, if you use two's complement representation to do negative numbers, then the answer is incorrect.In case you don't know, two's complement representation uses a leading bit to store the sign of a number. If it is 0, the number is positive, and if it is 1, then the number is negative. To negate a number, you flip ALL the bits, AND THEN you add 1 to the number.
i.e. 5 = 0101 (padded to 4 bits so you see the leading bit)
flip: 1010 = -6
add 1: 1011 = -5
Now, you should be able to see why if F(n) is the function you're making, F(n) != F(-n) for a large number of values of n. Instead, if you're computing this for negative numbers, you need to know how many bits store your number, and then you can make a proper function.