Computer Science
Information Representation
Number Representation
🤓 Study
📖 Quiz
Play audio lesson
Number Representation
Number Representation
Binary Representation
- Binary is a base-2 number system most commonly used in digital systems, as it can easily be represented by two states: On (1) or Off (0)
- A binary digit, or bit, is the smallest unit of data in computing and can represent two discrete states
- Eight bits together form one byte, the basic addressable element in many computer architectures
- Binary numbers are often needed to be padded with leading zeros to make up a certain bit-length
- Binary can be converted back and forth with other number systems like decimal, octal, and hexadecimal
Decimal Representation
- Decimal is a base-10 number system used universally in mathematics and arithmetic
- Ten distinct symbols (0-9) are used to represent numbers in the decimal system
- Despite its widespread use, decimal is less computer-friendly and is often converted to binary or other forms for easier processing
Octal Representation
- Octal is a base-8 number system, not as widely used as binary or decimal, but sometimes seen in computing
- Eight distinct symbols (0-7) are used to represent numbers in the octal system
- Each octal digit corresponds to three binary digits, which can simplify certain binary operations
Hexadecimal Representation
- Hexadecimal is a base-16 number system, commonly used in computing to reduce the number of digits needed to represent binary numbers
- Sixteen distinct symbols (0-9, A-F) are used to represent numbers in the hexadecimal system
- Each hexadecimal digit corresponds to four binary digits, making this system particularly useful in information representation
Two's Complement
- Two's complement is a method of representing negative binary numbers in a normalized way
- In two's complement notation, the leftmost bit indicates the sign (0 for positive, 1 for negative)
- To obtain a negative number in two's complement, one inverts the binary representation of the positive number and adds 1 to the least significant bit
Floating Point Representation
- The IEEE 754 Floating Point Representation allows for the representation of very large or very small numbers by separating a number into its sign, exponent and mantissa
- Any number can be represented in scientific notation, which forms the basis of floating point representation
- Floating point representation allows efficient scaling of numbers, but can suffer from rounding errors
Character Representation
- Text and special characters are often represented as binary using standardized codes such as ASCII and Unicode
- The ASCII code standard assigns unique binary numbers to 128 characters, including basic Latin alphabet characters, digits, symbols, and control codes
- Unicode extends this to a wider range of characters, including those from non-Latin scripts, and is used worldwide for its compatibility and flexibility.