Number system concept
A number system is a structured method of representing numerical values using a set of symbols and rules. Positional number systems assign different weights to digits according to their positions. The base or radix determines the number of distinct symbols used in the system and the positional weights.
Major number systems
Decimal
Base
10
Digits
0 through 9
Description
The decimal system is the standard base-10 numeral system used in everyday arithmetic. Each position represents a power of ten.
Example
472 = 4 × 10² + 7 × 10¹ + 2 × 10⁰.
Binary
Base
2
Digits
0 and 1
Description
The binary system uses two symbols and is the fundamental number representation used by conventional digital computers. Each binary digit is called a bit.
Example
1011₂ = 1 × 2³ + 0 × 2² + 1 × 2¹ + 1 × 2⁰ = 11₁₀.
Octal
Base
8
Digits
0 through 7
Description
The octal system uses eight symbols. Each octal digit corresponds directly to a group of three binary bits.
Example
25₈ = 2 × 8¹ + 5 × 8⁰ = 21₁₀.
Hexadecimal
Base
16
Digits
0 through 9 and A through F
Description
The hexadecimal system uses sixteen symbols, where A through F represent decimal values 10 through 15. Each hexadecimal digit corresponds directly to four binary bits.
Example
2F₁₆ = 2 × 16¹ + 15 × 16⁰ = 47₁₀.
Positional representation
In a positional numeral system, a number is represented as a sum of digits multiplied by powers of the system's base. For a base-b number with digits dₙ through d₀, its value is the sum of each digit multiplied by the corresponding power of b.
Formula
Name
Positional Number System Expansion
Expression
N = d_n b^n + d_(n-1) b^(n-1) + ... + d_1 b^1 + d_0 b^0
Description
This expression calculates the numerical value represented by the digits of a positional numeral system.
Conditions
Each digit must be valid for the chosen base. For an integer positional representation, the digit values range from 0 to b − 1.
Variables
N
The numerical value represented by the positional numeral system.
B
The base or radix of the number system, such as 2, 8, 10, or 16.
D n
The digit occupying the position with positional weight b^n.
N
The highest digit position in the represented integer.
Base conversion
Binary to decimal
Multiply each binary digit by its corresponding power of two and add the results.
Decimal to binary integer
Repeatedly divide the positive decimal integer by two and read the remainders in reverse order.
Binary to octal
Group binary digits into sets of three, starting from the binary point and moving outward, then convert each group into one octal digit.
Binary to hexadecimal
Group binary digits into sets of four, starting from the binary point and moving outward, then convert each group into one hexadecimal digit.
Decimal fraction to binary
Repeatedly multiply the fractional part by two, recording the integer part produced at each step. The process may terminate or continue indefinitely depending on the fraction.
Binary arithmetic
Addition
Binary addition follows the same positional principles as decimal addition, but each column produces a carry when its total reaches two.
Subtraction
Binary subtraction uses borrowing or complementary representations, depending on the arithmetic system.
Multiplication
Binary multiplication uses partial products formed from the binary digits and combines them through addition and shifting.
Division
Binary division follows positional long-division principles and can be implemented through repeated comparison, subtraction, and shifting.
Integer representation
Unsigned integer
An unsigned n-bit integer represents nonnegative values from 0 to 2ⁿ − 1.
Signed magnitude
Uses one bit to indicate sign and the remaining bits to represent magnitude. It has both positive and negative zero representations.
Ones complement
Represents negative values by inverting every bit of the corresponding positive representation. It also has two representations of zero.
Twos complement
The most widely used conventional signed integer representation. A negative value is represented by inverting the bits of the positive magnitude and adding one. For an n-bit two's-complement integer, the representable range is −2ⁿ⁻¹ through 2ⁿ⁻¹ − 1.
Floating point representation
Floating-point formats represent a wide range of real-number approximations using a sign, exponent, and significand or fraction. The IEEE 754 standard defines widely used binary floating-point formats. Because the significand has finite precision, many real numbers cannot be represented exactly, which can produce rounding errors.
Floating point formula
Name
Normalized Binary Floating-Point Representation
Expression
(-1)^s × 1.f × 2^e
Description
A simplified expression for a normalized binary floating-point value, where the leading significand bit is one.
Conditions
This is a conceptual normalized representation. Actual IEEE 754 encodings use a stored exponent field with a bias, a fraction field, and special encodings for zero, subnormal values, infinity, and NaN.
Floating point variables
S
The sign bit, where 0 indicates a nonnegative sign and 1 indicates a negative sign.
F
The stored fractional portion of the normalized significand.
E
The effective exponent after applying the exponent bias in the encoded representation.
Character encoding
Ascii
An early character encoding system that represents basic English letters, digits, punctuation, and control characters using 7-bit codes.
Unicode
A universal character repertoire designed to represent characters from many writing systems and symbol collections.
Utf8
A variable-length Unicode encoding that represents each Unicode scalar value using one to four bytes and preserves ASCII byte values for the basic ASCII range.
Utf16
A Unicode encoding that represents characters using one or two 16-bit code units.
Utf32
A Unicode encoding that uses a fixed 32-bit code unit for each Unicode scalar value.
Multimedia representation
Text
Text is represented through character encodings that map abstract characters to numerical code points and byte sequences.
Images
Digital images are represented through pixels or other image structures. Raster images store pixel values, commonly using channels such as red, green, and blue.
Audio
Digital audio commonly represents sound through sampled amplitude values measured at a particular sampling rate and quantization precision.
Video
Digital video represents sequences of image frames, often combined with audio, timestamps, compression, and synchronization information.
Compression
Compression reduces the amount of data required to store or transmit information. Lossless compression preserves the original data exactly, while lossy compression discards selected information to reduce size.
Digital storage units
Bit
The fundamental unit of binary information, capable of representing one of two states.
Byte
A group of eight bits in modern conventional computing.
Kilobyte
In the decimal SI system, 1 kB = 1000 bytes.
Megabyte
In the decimal SI system, 1 MB = 1000 kB.
Gigabyte
In the decimal SI system, 1 GB = 1000 MB.
Binary prefixes
The IEC binary prefixes are KiB = 1024 bytes, MiB = 1024 KiB, and GiB = 1024 MiB.
Representation limitations
Digital representation has finite precision and finite storage capacity. Integer overflow can occur when an arithmetic result exceeds the representable range. Floating-point calculations can introduce rounding errors. Character encoding mismatches can produce incorrect text, while lossy compression can remove information permanently.
Advanced topics
Fixed-point and floating-point numerical representation.
IEEE 754 floating-point formats and rounding modes.
Endianness and byte ordering.
Error-detection and error-correction coding.
Data compression and entropy coding.
Binary serialization and data interchange formats.
Digital image, audio, and video representation.
Arbitrary-precision arithmetic and numerical stability.