Gallery
Software
Music
Programming
Archive
Tuesday, May 21 Week 21

Byte

A byte is a number in the range from 0 to 255 (256 possible values).
This is an unsigned number because all possible values are positive.

Signed byte (8-Bit)

A signed byte is a number in the range is -128 to 127 (256 possible values).
With signed numbers the first bit is reserved for the +/- sign.
Now the highest value of a signed byte is 127, so 127+1 = -128.

Bits

For a single bit there is two possible values: 0 and 1.
With two bits the first bit can again be 0 and 1, -
so combinations are doubled for each bit that is available (see table of bits below.)

Decimal systems

System Range
Decimal 0..255
Hexadecimal 00..FF
Binary 00000000..11111111

List of common data types

Data type Size Description Range
Char 1 byte Ansi char #0..#255 ($00..$FF)
Word 2 bytes 16-Bit unsigned 0..65535 ($0000..$FFFF)
LongWord (cardinal) 4 bytes 32-Bit unsigned 0..4294967295 ($00000000..$FFFFFFFF)
ShortInt 1 byte 8-Bit unsigned -128..127 ($00..$FF)
SmallInt 2 bytes 16-Bit signed -32768..32767 ($0000..$FFFF)
LongInt (integer) 4 bytes 32-Bit signed -2147483648..2147483647 ($00000000..$FFFFFFFF)
Int64 8 bytes 64-Bit signed -9223372036854775808..9223372036854775807
Single 4 bytes float
Double 8 bytes float
Extended 10 bytes float
String (AnsiString) length()+1 NULL terminated (#0)

Table of bits and combinations

Bits Bytes Highest value Combinations
1 <1 0x0000000000000001 2
2 <1 0x0000000000000003 4
3 <1 0x0000000000000007 8
4 <1 0x000000000000000F 16
5 <1 0x000000000000001F 32
6 <1 0x000000000000003F 64
7 <1 0x000000000000007F 128
8 1 0x00000000000000FF 256
9 <2 0x00000000000001FF 512
10 <2 0x00000000000003FF 1.024
11 <2 0x00000000000007FF 2.048
12 <2 0x0000000000000FFF 4.096
13 <2 0x0000000000001FFF 8.192
14 <2 0x0000000000003FFF 16.384
15 <2 0x0000000000007FFF 32.768
16 2 0x000000000000FFFF 65.536
17 <3 0x000000000001FFFF 131.072
18 <3 0x000000000003FFFF 262.144
19 <3 0x000000000007FFFF 524.288
20 <3 0x00000000000FFFFF 1.048.576
21 <3 0x00000000001FFFFF 2.097.152
22 <3 0x00000000003FFFFF 4.194.304
23 <3 0x00000000007FFFFF 8.388.608
24 3 0x0000000000FFFFFF 16.777.216
25 <4 0x0000000001FFFFFF 33.554.432
26 <4 0x0000000003FFFFFF 67.108.864
27 <4 0x0000000007FFFFFF 134.217.728
28 <4 0x000000000FFFFFFF 268.435.456
29 <4 0x000000001FFFFFFF 536.870.912
30 <4 0x000000003FFFFFFF 1.073.741.824
31 <4 0x000000007FFFFFFF 2.147.483.648
32 4 0x00000000FFFFFFFF 4.294.967.296
33 <5 0x00000001FFFFFFFF 8.589.934.592
34 <5 0x00000003FFFFFFFF 17.179.869.184
35 <5 0x00000007FFFFFFFF 34.359.738.368
36 <5 0x0000000FFFFFFFFF 68.719.476.736
37 <5 0x0000001FFFFFFFFF 137.438.953.472
38 <5 0x0000003FFFFFFFFF 274.877.906.944
39 <5 0x0000007FFFFFFFFF 549.755.813.888
40 5 0x000000FFFFFFFFFF 1.099.511.627.776
41 <6 0x000001FFFFFFFFFF 2.199.023.255.552
42 <6 0x000003FFFFFFFFFF 4.398.046.511.104
43 <6 0x000007FFFFFFFFFF 8.796.093.022.208
44 <6 0x00000FFFFFFFFFFF 17.592.186.044.416
45 <6 0x00001FFFFFFFFFFF 35.184.372.088.832
46 <6 0x00003FFFFFFFFFFF 70.368.744.177.664
47 <6 0x00007FFFFFFFFFFF 140.737.488.355.328
48 6 0x0000FFFFFFFFFFFF 281.474.976.710.656
49 <7 0x0001FFFFFFFFFFFF 562.949.953.421.312
50 <7 0x0003FFFFFFFFFFFF 1.125.899.906.842.624
51 <7 0x0007FFFFFFFFFFFF 2.251.799.813.685.248
52 <7 0x000FFFFFFFFFFFFF 4.503.599.627.370.496
53 <7 0x001FFFFFFFFFFFFF 9.007.199.254.740.992
54 <7 0x003FFFFFFFFFFFFF 18.014.398.509.481.984
55 <7 0x007FFFFFFFFFFFFF 36.028.797.018.963.968
56 7 0x00FFFFFFFFFFFFFF 72.057.594.037.927.936


Related pages of Bytes and data-types

Character sets
Programming
Colors and formats
Delphi programming