Why do you want to remove the undefined error? It's perfectly sensible to keep it.

The function you deceived (technically called the "sign" function, but not to be confused with the "sine" function) makes perfect sense with the error. Think about it like this:

You want the function to return a "sign" indicating which number is larger than the other, if they are equal then this question makes no sense and an error is rightly returned.

If you need a function that say, returns 0 when they are equal, just use a piecewise:

signoreqaual(a, b) = (a-b)/|a-b| if a ≠ b, or 0 if a=b

Likewise, if you want a function that returns +1 if one is greater than the other, or 0 otherwise:

greaterthan(a, b) = 0.5 + ((a-b)/|a-b| if a ≠ b, or -1 if a=b)/2

Or simply:

greaterthan(a, b) = 1 if a>b, otherwise 0