On Sun, 2003-01-19 at 19:09, Nasser Ossareh wrote: > Isn't there a typo somewhere... > Shouldn't you expect 5 instead of -5 (15 - id where id = 10)?? > > Nevermind, let's assume that there is a typo somewhere and the correct expected >value is -5... however, in the domain of unsigned arithmetics -5 is precisely >18446744073709551611... don't you believe me: look at this: > > 18446744073709551611 + 5 = 18446744073709551616 which is 2 to power 64 (2^64). >Clearly in the architecture that you are using an unsigned int is a 64 bits >integer... if you set all the bits to 1 you will get the largest unsigned int in your >system and that is 18446744073709551615 which is (2^64)-1. if you increment it by >one... all the bits switch to 0. Hence within your architecture 2^64 = 0 and -5 is >represented correctly by 18446744073709551611 (which is 2^64 - 5). > > Nasser > sql, smallint, ... Beautifully explained.
Adolfo --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php