Skip to content

Latest commit

 

History

History
41 lines (24 loc) · 1.87 KB

digital-information.md

File metadata and controls

41 lines (24 loc) · 1.87 KB

Bits and bytes

  • Single binary value (0 or 1) is a bit (b).
  • A group of 8 binary digits is a byte (B)
  • A nibble is half of a byte (4 bits))

A protocol of communication: Bitsize - how many bits are in a message. Bitrate - no. of bits transmitted each second.

8 bits can store up to 255 values. 16 bits can store up to 65536 values.

Dates

Are stored as number of seconds from 00:00:00 UTC Jan 1 1970. We'll run out of bits on 03:14:07 UTC Jan 19 2038.

Characters

ASCII - basic set, letters, numbers, symbols (128 out of 255 possible combinations for a byte). ANSI tried to codify the rest.

Unicode - newer standard that includes more characters. Each symbol is represented by U++hex string

UTF-8 - standard for storing Unicode. U++1-6 bytes.

There ain't no such thing as plain text - there are only bytes, so one has to know the encoding to know what the bytes mean. In HTML, <meta charset="utf-8" /> can be understood when it's on top of the document, because almost every encoding does the same with bytes 32-127 (can be read as anything to determine as what it should be read).

Compression

Is generally about finding repeting patterns. Lossy = when decompressed, will not be exactly as original.

Numbers

Bitlength is how many bits are used to represent the number. If some of the bits are unused then they’re just set to 0 (left-pad).

integers, floats, doubles - Floats and doubles use a decimal point (e.g. 1.9395) but a float has a bitlength of 32, while a double has a bitlength of 64.

A signed number is one that can be either negative or positive. Unsigned numbers are always assumed to be positive.

Endian - means whether the number should be read from left to right or right to left. Big-endian - the digits on the left are “bigger”.