🍋
Menu
Math

Hamming Distance

The number of positions at which corresponding bits or symbols of two equal-length strings differ, used in error detection and coding theory.

Chi tiết kỹ thuật

Hamming Distance is the foundation of all digital computing. Each bit represents a power of 2: the byte 10110101 = 128+32+16+4+1 = 181. Bitwise operations (AND, OR, XOR, NOT, shift) manipulate individual bits for flags, masks, and permissions. Two's complement encodes negative integers: flipping bits and adding 1. IEEE 754 floating-point uses sign (1 bit), exponent (8/11 bits), and mantissa (23/52 bits) to represent real numbers with controlled precision trade-offs.

Ví dụ

```
Binary conversion:

  Decimal 42 → Binary:
  42 ÷ 2 = 21 r0 → 101010

  Binary 101010 → Decimal:
  1×32 + 0×16 + 1×8 + 0×4 + 1×2 + 0×1 = 42

  Hex 0x2A → Binary: 0010 1010
  Each hex digit = 4 bits (nibble)
```

Công cụ liên quan

Thuật ngữ liên quan