Re: [Tutor] What is the augmented assignment operator "^="

2007-02-19 Thread Dick Moores
My sincere thanks to Rikard Bosnjakovic, Andre Engels, and Alan Gauld. I think you've given me a good start toward understanding the operators >>, <<, &, ^, and | ; 32-bit numbers, and negative binary numbers. Dick Moores ___ Tutor maillist - Tut

Re: [Tutor] What is the augmented assignment operator "^="

2007-02-19 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote > Thanks, Andre! I've got it for the three operators, for non-negative > integers. But I'm not sure I understand how negative integers work. > For example, is 3 & -3 = 1 > because it is 11 & -11 = 01, and that's because one of the first > digits of 11 and -1

Re: [Tutor] What is the augmented assignment operator "^="

2007-02-19 Thread Rikard Bosnjakovic
On 2/19/07, Dick Moores <[EMAIL PROTECTED]> wrote: > It's the remaining seven I'm wondering about, or really about >>, <<, > &, ^, and | . This webpage will tell you - in detail - about all the operators: http://www.lnf.infn.it/Calcolo/doc/aixcxx/html/language/ref/ruclxbin.htm The bitwise operat

Re: [Tutor] What is the augmented assignment operator "^="

2007-02-19 Thread Andre Engels
2007/2/19, Dick Moores <[EMAIL PROTECTED]>: At 02:17 AM 2/19/2007, Andre Engels wrote: >To understand these operators, you will have to think of the numbers >as binary numbers. Look at the digits. For two numbers x and y, x^y >is the effect of doing an exclusive or on all digits (that is, 0^1 =

Re: [Tutor] What is the augmented assignment operator "^="

2007-02-19 Thread Dick Moores
At 03:32 AM 2/19/2007, you wrote: >Dick Moores wrote: >>The docs list it at , >>and send you to >>, which seems a dead end. > >a += n is more-or-less a shortcut for a = a + n. There are a few >subtlet

Re: [Tutor] What is the augmented assignment operator "^="

2007-02-19 Thread Kent Johnson
Dick Moores wrote: > The docs list it at , and > send you to , > which seems a dead end. a += n is more-or-less a shortcut for a = a + n. There are a few subtleties which the first page you reference

Re: [Tutor] What is the augmented assignment operator "^="

2007-02-19 Thread Dick Moores
At 02:17 AM 2/19/2007, Andre Engels wrote: >To understand these operators, you will have to think of the numbers >as binary numbers. Look at the digits. For two numbers x and y, x^y >is the effect of doing an exclusive or on all digits (that is, 0^1 = >1^0 = 1 and 0^0 = 1^1 = 0), & of doing an

Re: [Tutor] What is the augmented assignment operator "^="

2007-02-19 Thread Andre Engels
2007/2/19, Dick Moores <[EMAIL PROTECTED]>: The docs list it at , and send you to , which seems a dead end. I've tried "^=" out a bit: >>> n = 5 >>> n ^= 8 >>> n 13 >>> n ^= 8 >>> n 5 >>> n ^= 8 >>>

Re: [Tutor] What is the augmented assignment operator "^="

2007-02-19 Thread Rikard Bosnjakovic
On 2/19/07, Dick Moores <[EMAIL PROTECTED]> wrote: > I've tried "^=" out a bit: [...] > and get that strange alternating behavior. Can someone explain? > And while at it, please also explain "&=" and "|=". ^ is XOR, & is AND, | is OR, all bitwise. You can read more about them here: http://www.so

[Tutor] What is the augmented assignment operator "^="

2007-02-19 Thread Dick Moores
The docs list it at , and send you to , which seems a dead end. I've tried "^=" out a bit: >>> n = 5 >>> n ^= 8 >>> n 13 >>> n ^= 8 >>> n 5 >>> n ^= 8 >>> n 13 >>> n ^= 8 >>> n 5 and get th