PHP function description: description of the decimal, binary, octal, and hexadecimal conversion functions. 1. description of the decimalsystem conversion function 1: The decimal to binary decbin () function. for example, echodecbin (12); 1100 echodecbin (26); and 11010 decbin
1. description of the
The first part of the Chinese character encoding Study Series. the PHP function is a detailed description of the conversion functions for decimal, binary, octal, and hexadecimal conversion. it mainly describes the conversion methods for each hexadecimal conversion to be used
This article introduces in detail the application of decimal, binary, octal and 16 binary conversion functions in PHP, and the friends who need it can refer to the following.
One, decimal system conversion function description1, decimal to Binary decbin () function, the foll
This article describes in detail the application of the decimal, binary, octal, and hexadecimal conversion functions in php. If you need them, refer to the following.
1. Description of the decimal system Conversion Function1. Decimal to binary decbin () function, as shown in
JQuery focus chart conversion-left and right jquery focus Conversion
1
To convert between left and right, you need to change the image while converting between left and right. (num = index; that is, the red part .), For details, see the code.
+ 32 + 64 + 0 = 107.
Binary 01101011 = decimal 107.
1. Convert binary to decimal
The basic practice of converting a binary number into a decimal number is to first write the binary number as an expansion of the weighting coefficient, and then sum the values according to the decimal addition Rules. This method is
1. Description of the Decimal System Conversion Function 1. Decimal to binary decbin () function, as shown in the following example:Echo decbin (12); // output 1100Echo decbin (26); // output 11010Decbin(PHP 3, PHP 4, PHP 5)Decbin -- convert decimal to binaryDescriptionString decbin (INT number)Returns a string contain
conversion
The conversion between the hexadecimal and binary systems is very simple. The hexadecimal to binary system processes every bit of the hexadecimal system as a binary four-bit system. If there are less than four digits, add a zero complement. If binary is converted to hexadecimal, the four bits of binary are processed as one of the hexadecimal values. See the example below:
1) convert the hexadec
. In the following course about hexadecimal conversion, you can find this point.
6.2 convert binary number to decimal number 6.2.1 convert to decimal number
0th bits in binary are 0 to the power of 2, and 1st bits are 1 to the power of 2 ......
Therefore, there is a binary number: 0110 0100, which is converted to a 10-digit system:
The following is a vertical la
(((@i*1.0)/@it) * - as decimal(5,0) ) [Percentage of 2 decimal places after 4-5 entry]--Keep 2 decimal places, and also a step to 4 5 in decimal placesSelectLTRIM (CAST ((@i*1.0)/@it) * - as decimal(5,0)))+'%'[Percentage]--Plus%number as a synthetic percentage, or you can
// Poj 1131 Al fractions decimal conversion between any hexadecimal notation// You must convert an octal decimal point to a decimal point,// The number of decimal places after conversion is three times the number of
Binary, octal, decimal, hexadecimal conversion, binary hexadecimal1. Preface
The most boring thing during each holiday is that you don't want to get up or eat. Founder just doesn't want to move, lie in bed, watch the mobile phone, and brush QQ space bored. Although few people are playing QQ space now, however, this kind of habit has never changed until now, and the QQ on the computer is suddenly flashing. I
hexadecimal to decimalUsing the Int () function, the first argument is the string ' 0Xff ', the second argument is the description, and the string is a number of binary numbers. The result of the conversion is a decimal number.>>> int (' 0xf ', 16)15Binary to Decimal>>> int (' 10100111110 ', 2)1342Octal to Decimal>>> I
1. Binary number, octal number, hexadecimal decimal number
There is a formula: binary number, octal number, hexadecimal number of the numbers of the number of each of the respective cardinality of the (N-1) of the second party, and the sum is the corresponding decimal number. Single digit, n=1 10, n=2 ... for example:
The 0 =0+4+2+0=6d of the 1 110b=1*2 of the +1*2 of the 2-time Square +0*2 of the two side
C # conversion between decimal and binary, hexadecimal, and octal,
1. Convert decimal to binary
After dividing the decimal number by 2, you can enter all the remainder into two parts to obtain the required binary data.
Public static string DecimalToBinary (int vDecimal) {/* divide the
bytes, and then they are combined into one byte: 6=0110, and A= 1010, so the entire byte is 01101010.To convert from binary to 16, you simply divide the bytes into half bytes, and the following explains this → point in detail.Suppose there is a binary number 01010101. First divide it into half bytes 0101 and 0101, and these half-byte values are 5 becauseThe bits corresponding to the value 1 are 1 and 4, respectively. Therefore, its hexadecimal representation is Ox55. To convert the binary numbe
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.