2 <clause number="14.9.2" title="Floating-point comparison operators">
3 <paragraph>The predefined floating-point comparison operators are: <code_example><![CDATA[
4 bool operator ==(float x, float y);
5 bool operator ==(double x, double y);
6 bool operator !=(float x, float y);
7 bool operator !=(double x, double y);
8 bool operator <(float x, float y);
9 bool operator <(double x, double y);
10 bool operator >(float x, float y);
11 bool operator >(double x, double y);
12 bool operator <=(float x, float y);
13 bool operator <=(double x, double y);
14 bool operator >=(float x, float y);
15 bool operator >=(double x, double y);
16 ]]></code_example></paragraph>
17 <paragraph>The operators compare the operands according to the rules of the IEEE 754 standard: <list><list_item> If either operand is NaN, the result is false for all operators except !=, for which the result is true. For any two operands, x != y always produces the same result as !(x == y). However, when one or both operands are NaN, the <, >, <=, and >= operators do not produce the same results as the logical negation of the opposite operator. <example>[Example: For example, if either of x and y is NaN, then x < y is false, but !(x >= y) is true. end example]</example> </list_item><list_item> When neither operand is NaN, the operators compare the values of the two floating-point operands with respect to the ordering <code_example><![CDATA[
18 {UNICODE_150}{UNICODE_8734} < {UNICODE_150}max < {UNICODE_133} < {UNICODE_150}min < {UNICODE_150}0.0 == +0.0 < +min < {UNICODE_133} < +max < +{UNICODE_8734}
19 ]]></code_example>where min and max are the smallest and largest positive finite values that can be represented in the given floating-point format. Notable effects of this ordering are: </list_item><list><list_item> Negative and positive zeros are considered equal. </list_item><list_item> A negative infinity is considered less than all other values, but equal to another negative infinity. </list_item><list_item> A positive infinity is considered greater than all other values, but equal to another positive infinity. </list_item></list></list></paragraph>