Home  >  Article  >  What base number starts with 0x?

What base number starts with 0x?

青灯夜游
青灯夜游Original
2019-06-04 11:04:5366249browse

In real life, our most common numbers are decimal numbers, such as the numbers on traffic lights, the time on electronic watches, etc. If you see 0xAA in these places, it will feel strange. But what do such numbers mean? The following article will introduce it to you, I hope it will be helpful to you.

What base number starts with 0x?

Data starting with 0x represents hexadecimal. The weight of each bit in the computer is 16, that is (hexadecimal) 10 = (decimal) 1×16 . Note: The 0 here is the number 0, not the letter O!

Hexadecimal (abbreviated as hex or subscript 16) is a carry system that bases 16 on every 16 in mathematics. Generally represented by numbers 0 to 9 and letters A to F (or a~f), where: A~F means 10~15, these are called hexadecimal numbers.

Today’s hexadecimal system is widely used in the computer field because it is not difficult to convert 4 bits into individual hexadecimal numbers. 1 byte can be represented as 2 consecutive hexadecimal numbers. However, this mixed notation is confusing and requires some prefix, suffix, or subscript to display.

How to convert decimal to hexadecimal?

The mathematical calculation method is: use the remainder theorem to decompose, for example, convert 487710 into hexadecimal:

877÷16=304....13(D)

304÷16=19....0

19÷16=1....3

##1÷16=0....1

This will count to 487710=130D16

You can also use functions in programming, for example: you can use the toString() function in Javascript to convert decimal numbers into other arbitrary base formats (String type) .

The above is the detailed content of What base number starts with 0x?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn