Ranking bug in the parking spot (compared with the unsigned number)

Source: Internet
Author: User

I sent this message to Qzone yesterday. It's still strange to think about it. It's just a joke when I find a bug. However, csdn does not support texture pasters. The original Article is http://user.qzone.qq.com/110907073/blog/1264524991.

First of all, today I am eager to see how my parking space is in the first place, although there have been many accidents recently. I was shocked. How did I go to the third place? Don't worry. Let's see how much the first and second places are more than me. Then, I was shocked. It was actually a negative number ...... No words. Let's take a closer look at the picture. My cash is 22309730 and there are 98800000 of fixed car assets. But now my sister, the number one, has a total assets of 4040, the current-20040 plus the 16000 (16000-20040 =-4040) of the car, no matter how her cash turns into a negative number, haha, let's see how programmers make this mistake.

Photo name: parking spot bug, powerful picture

 

I thought it was a bug caused by integer overflow, but the second name below is also a negative number, which is a negative 28360. If it is an integer overflow, the total assets displayed should be incorrect, because carry will be directly lost, there should be no problem in calculating this part. When the problem is compared, it is estimated that this brother cannot have a negative number, I wrote a comparison between two unsigned numbers. If the problem arises, a negative number occurs:

The maximum unsigned integer of 32 bits is (0 xffffffff) 2's 32 power minus 1, 4294967295

Convert-4040 to a computer representation (Binary complement code): 1111 1111 1111 1111 1111 0000 0011 1000 if the unsigned number is 4294963256, the conversion from-28360 to 4294938936 is also true, haha, it is indeed the first, the second, and more than 121109730 of my total assets.

However, the ranking in the friend list is correct. Maybe these two parts are written by two different people. Hey.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.