Compare two integers in C or C++ without comparison operators Produce the shortest program which takes two signed integers as input (through stdin or as arguments) and displays 3 different outputs depending upon whether the first number is (1) greater than, (2) smaller than, or (3) equal to the second number.

The Catch

You cannot use any of the following in your program:


The standard comparison operators: &lt;, &gt;, &lt;=, &gt;=, ==, !=.
Any library file apart from conio, stdio, or iostream.
Any non-ASCII or non-printable ASCII character.


The Winner

The program with the shortest number of characters wins.
90 bytes

If we can use stdio, why not use its formatting capabilities to perform comparison?

main(a,b){scanf("%d%d",&amp;a,&amp;b);snprintf(&amp;a,2,"%d",b-a);a&amp;=63;putchar(51-!(a-45)-!!(a-48));}


Assumes ASCII-compatible encoding and little-endianness.

72 bytes

Quotients are rounded toward zero but right-shifts are (in practice) "rounded down". That's a dead giveaway.

main(a,b){scanf("%d%d",&amp;a,&amp;b);a-=b;putchar(a?a|=1,a/2-(a&gt;&gt;1)?60:62:61);}


65 79 bytes

Another distinguishing property of negative numbers is that they produce negative modulo.
This one doesn't depend on integer representation at all; it even works on my 8-bit excess-127 toaster!
Oh, and since we can use conio, why not save two bytes with putch? Now, if I could only find my copy of TurboC...

main(a,b){scanf("%d%d",&amp;a,&amp;b);long long d=a;d-=b;putch(d?d|=1,d%2-1?60:62:61);}


EDIT: Handle large differences assuming long long is wider than int.