Difference between revisions of "Hexadecimal"
From Free Pascal wiki
Jump to navigationJump to search (New page: Hexadecimal (hex) is number system to the base 16. In hexadecimal the decimal numbers 0–15 are represented by the symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. Hexadecimal ...) |
(rewording of sentence) |
||
(11 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
− | Hexadecimal | + | {{Hexadecimal}} |
− | In [[Pascal]] hexadecimal is indicated by | + | Hexadecimal (hex) is number system to the base 16. In hexadecimal the decimal numbers 0–15 are represented by the symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. Hexadecimal numbers are easy to convert to the computer's internal binary code and are more compact than [[Binary numeral system|binary numbers]]. One hexadecimal digit stands in place of four binary bits (4-bits). |
+ | |||
+ | In [[Pascal]] a hexadecimal literal is indicated by using a [[Dollar_sign|$]] prefix. | ||
Line 7: | Line 9: | ||
− | {| | + | {| class="wikitable" |
− | + | ! Hexadecimal !! Decimal !! Binary | |
− | |||
− | |||
|- | |- | ||
| $0000 | | $0000 | ||
| 0 | | 0 | ||
− | | 0000000000000000 | + | | [[Percent_sign|%]]0000000000000000 |
|- | |- | ||
| $0001 | | $0001 | ||
| 1 | | 1 | ||
− | | 0000000000000001 | + | | %0000000000000001 |
|- | |- | ||
| $0002 | | $0002 | ||
| 2 | | 2 | ||
− | | 0000000000000010 | + | | %0000000000000010 |
|- | |- | ||
| $0003 | | $0003 | ||
| 3 | | 3 | ||
− | | 0000000000000011 | + | | %0000000000000011 |
|- | |- | ||
| $0004 | | $0004 | ||
| 4 | | 4 | ||
− | | 0000000000000100 | + | | %0000000000000100 |
|- | |- | ||
| $0005 | | $0005 | ||
| 5 | | 5 | ||
− | | 0000000000000101 | + | | %0000000000000101 |
|- | |- | ||
| $0006 | | $0006 | ||
| 6 | | 6 | ||
− | | 0000000000000110 | + | | %0000000000000110 |
|- | |- | ||
| $0007 | | $0007 | ||
| 7 | | 7 | ||
− | | 0000000000000111 | + | | %0000000000000111 |
|- | |- | ||
| $0008 | | $0008 | ||
| 8 | | 8 | ||
− | | 0000000000001000 | + | | %0000000000001000 |
|- | |- | ||
| $0009 | | $0009 | ||
| 9 | | 9 | ||
− | | 0000000000001001 | + | | %0000000000001001 |
|- | |- | ||
| $000a | | $000a | ||
| 10 | | 10 | ||
− | | 0000000000001010 | + | | %0000000000001010 |
|- | |- | ||
| $000b | | $000b | ||
| 11 | | 11 | ||
− | | 0000000000001011 | + | | %0000000000001011 |
|- | |- | ||
| $000c | | $000c | ||
| 12 | | 12 | ||
− | | 0000000000001100 | + | | %0000000000001100 |
|- | |- | ||
| $000d | | $000d | ||
| 13 | | 13 | ||
− | | 0000000000001101 | + | | %0000000000001101 |
|- | |- | ||
| $000e | | $000e | ||
| 14 | | 14 | ||
− | | 0000000000001110 | + | | %0000000000001110 |
|- | |- | ||
| $000f | | $000f | ||
| 15 | | 15 | ||
− | | 0000000000001111 | + | | %0000000000001111 |
|- | |- | ||
| $0010 | | $0010 | ||
| 16 | | 16 | ||
− | | 0000000000010000 | + | | %0000000000010000 |
|- | |- | ||
| $0011 | | $0011 | ||
| 17 | | 17 | ||
− | | 0000000000010001 | + | | %0000000000010001 |
|- | |- | ||
| $0012 | | $0012 | ||
| 18 | | 18 | ||
− | | 0000000000010010 | + | | %0000000000010010 |
|- | |- | ||
| $0013 | | $0013 | ||
| 19 | | 19 | ||
− | | 0000000000010011 | + | | %0000000000010011 |
|- | |- | ||
| $0014 | | $0014 | ||
| 20 | | 20 | ||
− | | 0000000000010100 | + | | %0000000000010100 |
|- | |- | ||
| ... | | ... | ||
Line 102: | Line 102: | ||
| $009f | | $009f | ||
| 159 | | 159 | ||
− | | 0000000010011111 | + | | %0000000010011111 |
|- | |- | ||
| $00a0 | | $00a0 | ||
| 160 | | 160 | ||
− | | 0000000010100000 | + | | %0000000010100000 |
|- | |- | ||
| ... | | ... | ||
Line 114: | Line 114: | ||
| $00ff | | $00ff | ||
| 255 | | 255 | ||
− | | 0000000011111111 | + | | %0000000011111111 |
|- | |- | ||
| $0100 | | $0100 | ||
| 256 | | 256 | ||
− | | 0000000100000000 | + | | %0000000100000000 |
|- | |- | ||
| $0101 | | $0101 | ||
| 257 | | 257 | ||
− | | 0000000100000001 | + | | %0000000100000001 |
|- | |- | ||
|} | |} | ||
+ | |||
+ | |||
+ | = See also = | ||
+ | |||
+ | [[Function]]s: | ||
+ | * [[doc:rtl/strutils/hex2dec.html|Hex2Dec]] Converts a hexadecimal [[String|string]] to a decimal value. | ||
+ | * [[doc:rtl/strutils/hextobin.html|HexToBin]] Convert a hexadecimal string to a binary buffer. | ||
+ | * [[doc:rtl/sysutils/inttohex.html|IntToHex]] Convert an [[Integer|integer]] value to a hexadecimal string. | ||
+ | |||
+ | [[Procedure]] | ||
+ | * [[doc:rtl/strutils/bintohex.html|BinToHex]] Convert a binary buffer to a hexadecimal string. |
Latest revision as of 04:06, 11 October 2023
│
Deutsch (de) │
English (en) │
suomi (fi) │
français (fr) │
português (pt) │
русский (ru) │
Hexadecimal (hex) is number system to the base 16. In hexadecimal the decimal numbers 0–15 are represented by the symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. Hexadecimal numbers are easy to convert to the computer's internal binary code and are more compact than binary numbers. One hexadecimal digit stands in place of four binary bits (4-bits).
In Pascal a hexadecimal literal is indicated by using a $ prefix.
Conversion Table
Hexadecimal | Decimal | Binary |
---|---|---|
$0000 | 0 | %0000000000000000 |
$0001 | 1 | %0000000000000001 |
$0002 | 2 | %0000000000000010 |
$0003 | 3 | %0000000000000011 |
$0004 | 4 | %0000000000000100 |
$0005 | 5 | %0000000000000101 |
$0006 | 6 | %0000000000000110 |
$0007 | 7 | %0000000000000111 |
$0008 | 8 | %0000000000001000 |
$0009 | 9 | %0000000000001001 |
$000a | 10 | %0000000000001010 |
$000b | 11 | %0000000000001011 |
$000c | 12 | %0000000000001100 |
$000d | 13 | %0000000000001101 |
$000e | 14 | %0000000000001110 |
$000f | 15 | %0000000000001111 |
$0010 | 16 | %0000000000010000 |
$0011 | 17 | %0000000000010001 |
$0012 | 18 | %0000000000010010 |
$0013 | 19 | %0000000000010011 |
$0014 | 20 | %0000000000010100 |
... | ... | ... |
$009f | 159 | %0000000010011111 |
$00a0 | 160 | %0000000010100000 |
... | ... | ... |
$00ff | 255 | %0000000011111111 |
$0100 | 256 | %0000000100000000 |
$0101 | 257 | %0000000100000001 |
See also
- Hex2Dec Converts a hexadecimal string to a decimal value.
- HexToBin Convert a hexadecimal string to a binary buffer.
- IntToHex Convert an integer value to a hexadecimal string.
- BinToHex Convert a binary buffer to a hexadecimal string.