Quote:
|
Originally Posted by codersguru
A %= B; means A = A % B;
Let’s assume that A = 10 and B = 4 then
A=10%4; //which will produce 2, so now A=2.
No, ">>=" is the Left Shift Assignment operator which shifts the bits of the left hand value left by the number of bits specified in the right hand value. (You will rarely use this operator).
The Greater Than or Equal operator is ">=" (only one Angle bracket).
Yes, A += B; is equal to: A = A + B; and means Add B to A and assign the result to A.
For example if we assumed A=5 and B=10 then:
A+=B will equal to A=10+5 then A=15 now.
|
Left shift is not a very interesting operation for traders.
It's a binary operation used for system computing.
For example if you have 32 (In binary = 00100000), and Left Shift it ... you get 00010000 (Move the numbers an item to the left). So ... you would get 16.
As binary is a power of 2.
Left Shift .... is very similar to divide a number by 2
Rigth Shift is very similar to multiply a number by 2.
I tell 'very similar' because according to the way of store numbers and store the sign of the number ... it's not exactly the same.
Anyway, you will never use it.