if Bitwise OR was used ieee-754 to calc the result in Javascript,i can't understand the result.
for example:
2|1 =>3
In ieee-754,
2
is stored as 0 10000000000 0000...0000
,and
1
is stored as 0 01111111111 0000...0000
if exec bitwise or,i think the result is 0 11111111111 0000...0000
,but why does it output 3
?
As same as above,
example:
0.1|0 =>0
0
is stored as 0 00000000000 0000...0000
,and
0.1
is stored as 0 01111111011 1001100110011001100110011001100110011001100110011010
if exec bitwise or,i think the result is 0 01111111011 1001100110011001100110011001100110011001100110011010
,but why does it output 0
,and lose decimal?
example:
2|-1 =>-1
2
is stored as 0 10000000000 0000...0000
,and
-1
is stored as 1 01111111111 0000...0000
if exec bitwise or,i think the result is 1 11111111111 0000...0000
,but why does it output -1
?