If you dont type cast it becomes long by default but with type cast it become unsigned giving it an extra bit for positive numbers. Try type casting it to long and see if the result is same.