Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

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

Custom base

Conversion Results

Decimal (base 10)255
Binary (base 2)11111111
Octal (base 8)377
Hexadecimal (base 16)FF

Data Table

(0 rows)
#InputBaseDecimalBinaryHexNotes
0 / 500
0 / 500
0 / 500

Reference Guide

Positional Notation

Every number system uses positional notation. Each digit is multiplied by the base raised to its position.

N=dn×bn+dn−1×bn−1+⋯+d1×b1+d0×b0N = d_n \times b^n + d_{n-1} \times b^{n-1} + \cdots + d_1 \times b^1 + d_0 \times b^0

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.

−N=N‾+1-N = \overline{N} + 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).

value=(−1)sign×2exponent−127×1.mantissa\text{value} = (-1)^{\text{sign}} \times 2^{\text{exponent} - 127} \times 1.\text{mantissa}

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.

AB ANDOR XORNOT A
000001
010111
100110
111100

Shift left (<<) multiplies by 2. Shift right (>>) divides by 2 (integer division).

Related Content