C# Language Specification


Floating-point comparison operators



Download 0,75 Mb.
bet249/524
Sana06.01.2022
Hajmi0,75 Mb.
#324842
1   ...   245   246   247   248   249   250   251   252   ...   524
Bog'liq
CSharp Language Specification

Floating-point comparison operators


The predefined floating-point comparison operators are:

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


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

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


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

bool operator <(float x, float y);


bool operator <(double x, double y);

bool operator >(float x, float y);


bool operator >(double x, double y);

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.

      1. Download 0,75 Mb.

        Do'stlaringiz bilan baham:
1   ...   245   246   247   248   249   250   251   252   ...   524




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish