I'm not sure this is safe.  I think it would be better check <, >, == and return -1, 1, 0 (otherwise it will have integer overflow problems I think)