Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
MySQL 1 – 1 = 18446744073709551615 (verysimple.com)
1 point by jakejake on March 12, 2016 | hide | past | favorite | 3 comments


Good reminder. Not specific to MySQL, though. This happens in many languages that have unsigned integers. The underlying bit pattern resulting from twos-complement arithmetic is the same for signed and unsigned arithmetic, but when interpreted as unsigned you get one more high bit instead of that bit representing the sign: 0 for positive, 1 for negative.


Shouldn't that be "0 - 1"?

"1 - 1" will correctly be computed as "0".


You're right, typo in the title!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: