How does "5.5 | 0 === 5" work?

How does it work 5.5 | 0 === 5?

Is it | 0bitwise in this context OR, I suspect this is so? If so, why did he disable everything after the dot?

+4
source share
3 answers

Bitwise operators always reduce operands to 32-bit targets.

The operation is interpreted as

5.5 | (0 === 5)

which the

5.5 | false

which is forced to

5.5 | 0

Now 5.5converts to a 32-bit integer, so we have

5 | 0

which is equal 5.

, , . ( , , ), .

+11

| , 32- . Pointy, 5.5 | 0 === 5 5.5 | (0 === 5), 5.5 | false.

:

& hellip;
5. lnum - ToInt32 (lval).
6. rnum ToInt32 (rval).
7. @ lnum rnum. 32- .

X | 0X , .

+4

It is not equal to true, it is simply not equal to false.

5.5 | 0 === 5 

returns

5
+4
source

All Articles