Number Systems & Data Representation Lab
Explore how computers store and interpret numbers. Convert between binary, octal, decimal, and hexadecimal, toggle individual bits to understand two's complement, and see why floating-point arithmetic produces surprising results like 0.1 + 0.2 not equaling 0.3.
Guided Experiment Base Conversion Patterns
Why is 255 a special number in computing? What patterns emerge when converting powers of 2 between bases?
Write your hypothesis in the Lab Report panel, then click Next.
Controls
Conversion Results
Data Table
(0 rows)| # | Input | Base | Decimal | Binary | Hex | Notes |
|---|
Reference Guide
Positional Notation
Every number system uses positional notation. Each digit is multiplied by the base raised to its position.
For example, 1010 in binary (base 2) equals 1 × 8 + 0 × 4 + 1 × 2 + 0 × 1 = 10 in decimal.
Two's Complement
Computers represent negative integers using two's complement. To negate a number, flip all bits and add 1.
For 8-bit signed integers, the range is -128 to 127. The most significant bit (MSB) serves as the sign bit, 0 for positive, 1 for negative.
IEEE 754 Floating Point
Single-precision floating-point numbers use 32 bits split into three fields, sign (1 bit), exponent (8 bits), and mantissa (23 bits).
Not all decimal fractions can be represented exactly. For example, 0.1 in decimal becomes a repeating pattern in binary, similar to how 1/3 repeats in decimal.
Bitwise Operations
Bitwise operations work on individual bits of integers. They are fundamental to low-level programming and hardware design.
| A | B | AND | OR | XOR | NOT A |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 |
Shift left (<<) multiplies by 2. Shift right (>>) divides by 2 (integer division).