[Tutor] What does ^ and | mean?

Alex Hall mehgcap at gmail.com
Fri Jan 28 16:16:17 CET 2011


Not sure about caret (^), but I believe | is binary or.
4|2
is
100 | 010 = 110, and 110 in decimal is 6.
4|4= 100|100 is 100 or 4.

The caret might be binary and, but I am not sure.

On 1/28/11, tee chwee liong <tcl76 at hotmail.com> wrote:
>
> hi,
>
> i'm confuse on how does ^ and | mean. When i tried |, i thought it is
> addition but 4|4 also give 4?
>>>> 4|2
> 6
>>>> 4|1
> 5
>>>> 4|3
> 7
>>>> 4|4
> 4
>
> When i tried ^, looks like subtraction but 2^4 gives 6?
>
>
>>>> 2^3
> 1
>>>> 2^2
> 0
>>>> 2^4
> 6
>
> Pls help to clear my confusion. thanks.
>
>
>
>
>   		 	   		


-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap at gmail.com; http://www.facebook.com/mehgcap


More information about the Tutor mailing list