Hmmm...
It doesn't work if a is very big and b is very small.
Type: Posts; User: Click_here
Hmmm...
It doesn't work if a is very big and b is very small.
OK - I've done it and the numbers that you were having trouble with are now working.
How I did it was to take the integers into the function unsigned, and the add (unsigned int)(-2147483648) that...
Can you use larger variables in your calculations?
i.e.
int isitGreater(int a, int b)
{
long int x = (long int) a;
In that case, I think that there is nothing wrong with the code you have.
If it is not working, you are going to have to explain what is not working.
Hey,
I have to admit that I have a soft-spot for bitwise operations.
I have a few suggestions for you
((~x)+1))
This is the 2's complement that is a lot easier to write like this:
...