Comparative Function for reals

31 Views Asked by At

In Computer Science, it is common to use a comparative function like $cmp(a, b)$ which returns either -1, 0, or 1 based upon the relative values of a and b. Commonly a result of -1 (or just less than 0) means that a < b, a result of 0 means that a = b, and a result of +1 (or just greater than 0) means that a > b.

I'm working on writing up some mathematical research that uses such a function, and I'm wondering if I should define the comparative function myself or if there isn't an already defined standard function that I could use with the same effect?

Thanks!