Sorry for the Objective-C, but spot this sly bug.

if (x1 < x2) {
    return NSOrderedAscending;
}
return x2 > x1 ? NSOrderedDescending : NSOrderedSame;