Comparison Macros
Document: N1449
int isgreater(real-floating x, real-floating y);
int isgreaterequal(real-floating x, real-floating y);
int isless(real-floating x, real-floating y);
int islessequal(real-floating x, real-floating y);
int islessgreater(real-floating x, real-floating y);
int isunordered(real-floating x, real-floating y);
All we say in the preamble to this clause is:
In the synopses in this subclause, real-floating indicates that the argument shall be an expression of real floating type.Nothing is said, one way or the other, about whether the two arguments must have the same real-floating type. But in the C++ Standard, clause 26.8 para. 12, the analogous templates are:
template <class T> bool isgreater(T x, T y);
template <class T> bool isgreaterequal(T x, T y);
template <class T> bool isless(T x, T y);
template <class T> bool islessequal(T x, T y);
template <class T> bool islessgreater(T x, T y);
template <class T> bool isunordered(T x, T y);
which comes down on the side of same-type arguments.
We have two choices:
template <class T, class U> bool isgreater(T x,
U y);
etc.
The two arguments to each function need not be of the same real floating type.The description of the functions that follow are clear enough that the usual arithmetic conversions will be applied in any comparison to bring the two operands to the common real type.