Replying to my own post... Let me add that the existing numeric <=> operators all do appear to strictly return -1, 0, or +1. That is, they don't simply return y-x to compute a value less than, equal to, or greater than zero. This would argue that the current documentation of Comparable is correct, but that the implementation is written so that it works even for broken <=> operators. Anyway, I should say that it was probably presumptuous of me to assume that the documentation is incorrect. Everything I've seen in writing says that <=> must return -1,0, or +1. The implementation in compar.c makes it appear that this is not the case, however. I was not able to find any discussion of the return value of <=> in the ruby-talk archives... David David Flanagan wrote: > The rdoc for the Comparable module and its methods consistently indicate > that the <=> method must return values -1, 0, or +1. But the > implementation consistently tests for values < 0, == 0 and > 0. > See compar.c in the source tree. > > I believe that this is a documentation bug, and I will submit a patch if > folks here agree with me. Shouldn't we be allowed to write our <=> > operators so that they return any Numeric value? > > David Flanagan >