X hits on this document

811 views

0 shares

0 downloads

0 comments

163 / 396

C# LANGUAGE SPECIFICATION

bool operator <=(float x, float y); bool operator <=(double x, double y);

bool operator >=(float x, float y); bool operator >=(double x, double y);

The operators compare the operands according to the rules of the IEEE 754 standard:

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. For example, if either of x and y is NaN, then x < y is false, but !(x >= y) is true.

When neither operand is NaN, the operators compare the values of the two floating-point operands with respect to the ordering

–∞ < –max < ... < –min < –0.0 == +0.0 < +min < ... < +max < +∞

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:

Negative and positive zeros are considered equal.

A negative infinity is considered less than all other values, but equal to another negative infinity.

A positive infinity is considered greater than all other values, but equal to another positive infinity.

7.9.3 Decimal comparison operators

The predefined decimal comparison operators are:

bool operator ==(decimal x, decimal y);

bool operator !=(decimal x, decimal y);

bool operator <(decimal x, decimal y);

bool operator >(decimal x, decimal y);

bool operator <=(decimal x, decimal y);

bool operator >=(decimal x, decimal y);

Each of these operators compares the numeric values of the two decimal operands and returns a bool value that indicates whether the particular relation is true or false. Each decimal comparison is equivalent to using the corresponding relational or equality operator of type System.Decimal.

7.9.4 Boolean equality operators

The predefined boolean equality operators are:

bool operator ==(bool x, bool y);

bool operator !=(bool x, bool y);

The result of == is true if both x and y are true or if both x and y are false. Otherwise, the result is false.

The result of != is false if both x and y are true or if both x and y are false. Otherwise, the result is true. When the operands are of type bool, the != operator produces the same result as the ^ operator.

7.9.5 Enumeration comparison operators

Every enumeration type implicitly provides the following predefined comparison operators:

bool operator ==(E x, E y);

bool operator !=(E x, E y);

150Copyright Microsoft Corporation 1999-2003. All Rights Reserved.

Document info
Document views811
Page views811
Page last viewedSun Dec 04 06:31:03 UTC 2016
Pages396
Paragraphs9401
Words133190

Comments