On 7/23/20 3:15 PM, Bruno Haible wrote:
+ AH_VERBATIM([micro_optimizations], +[/* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2. + It returns + 1 if n1 > n2 + 0 if n1 == n2 + -1 if n1 < n2
While looking into using this in Emacs I noticed that _GL_CMP (A, B) currently returns 0 if either A or B is a NaN. I suggest that we change the documentation comment for _GL_CMP to say specifically that the result is indeterminate if either argument is a NaN, to make it clearer that callers should not expect the result to be 0 in this case.
Another possibility would be to document that the result is 0 in this case, but I don't see how that would be useful, as macros like _GL_CMP don't work if arguments are not taken from a total order.
Still another possibility would be to restrict _GL_CMP's arguments to integers, but I could see uses of that macro on non-NaN floating-point values (though Emacs doesn't happen to have any such uses now).