Compares two values and returns the result of the comparison as an integer.