The little knowledge in the character (what is the decimal of "123")

Source: Internet
Author: User

In the database, when the data entered, encountered a small problem. When you set the variable type to Bit, the data you write in is: "123",

A value like this is displayed: 3224115,

After several experiments, it was found that this was not an accidental value, and the result value of the following ' 0 ' was tried: 48, ' 1 ' result value: 49

Tried a bit ' 10 ' Result: 12592

Here is the analysis:

We know that for any number, the way the expression in the computer is binary, for convenience, we use Hex to store

By ' 0 ' and ' 1 ' know this is a asccii value of 48 49

However, for the value ' 10 ', the decimal value of ' 1 ' is 496 in value: 0x31 ' 0 ' has a decimal value of: 48, and the hexadecimal number is: 0x30

So the decimal number of ' 10 ' is: ox3031 conversion to binary is also possible.     Of course the result is the same! 12592

So the value of "123" is first converted to ASSIICC value (49,50,51)--"switch to 16 binary: 0x313233 to binary or decimal

Number: 3224115

The little knowledge in the character (what is the decimal of "123")

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.