Binary in Computing
How Computers Think in 1s y 0s
Understand BinaryEvery photo, video, program, y website ultimately exists as patterns of 1s y 0s. Binary isn't solo otro numero sistema—eso's el/la foundation of todo digital technology. Understanding binary reveals como computers trabajar at su la mayoria fundamental level.
Bits y Bytes
El/La Bit
- Smallest unidad of datos
- Single binary digit: 0 o 1
- "Binary digit" shortened un/una "bit"
- Can represent two states (yes/no, on/off, true/false)
El/La Byte
- 8 bits grouped together
- Can represent 2⁸ = 256 diferente valores (0-255)
- Standard unidad for character storage
- Foundation for larger unidades (KB, MB, GB)
Larger Units
| Unidad | Size | Values |
|---|---|---|
| Byte | 8 bits | 256 |
| Word (16-bit) | 2 bytes | 65,536 |
| Double word (32-bit) | 4 bytes | ~4.3 billion |
| Quad word (64-bit) | 8 bytes | ~18.4 quintillion |
How Data Is Represented
Text (Characters)
- ASCII: 7 bits, 128 characters
- Extended ASCII: 8 bits, 256 characters
- Unicode (UTF-8): Variable length, millions of characters
Ejemplo: 'Un/Una' = 01000001 (65 in decimal)
Numbers
- Integers: Direct binary representation
- Negative numeros: Two's complement
- Decimals: Floating-point (IEEE 754)
Images
- Pixels represented as numeros
- RGB: 3 bytes per pixel (8 bits cada for Red, Green, Blue)
- 1920×1080 image ≈ 6.2 million bytes uncompressed
Audio
- Sound waves sampled as numeros
- CD quality: 16-bit samples, 44,100 times per segundo
Binary Arithmetic
Addition
Same as decimal, pero carry at 2:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (0, carry 1)
- 1 + 1 + 1 = 11 (1, carry 1)
Ejemplo: 1011 + 1101
1011 + 1101 ------ 11000
= 11 + 13 = 24 ✓
Logic Gates
Hardware implements binary operations through logic gates:
Basic Gates
| Gate | Function | Truth |
|---|---|---|
| AND | Both inputs debe be 1 | 1 AND 1 = 1 |
| OR | At menos one input es 1 | 1 OR 0 = 1 |
| NOT | Inverts input | NOT 1 = 0 |
| XOR | Exactly one input es 1 | 1 XOR 1 = 0 |
| NAND | NOT AND | 1 NAND 1 = 0 |
Complex operations (addition, comparison) son built desde combinations of estos simple gates.
Signed Numbers: Two's Complement
How computers represent negative numeros:
Method
- Invert todo bits
- Suma 1
Ejemplo: -5 in 8-bit
- 5 = 00000101
- Invert: 11111010
- Suma 1: 11111011
- -5 = 11111011
Why Two's Complement?
- Addition works naturally (no special cases)
- One representation for zero
- Easy un/una implement in hardware
Bitwise Operations in Programming
Programming languages proporcionar operators for bit manipulation:
Common Operations
- AND (&): Mask certain bits
- OR (|): Set certain bits
- XOR (^): Toggle bits, encryption
- NOT (~): Invert todo bits
- Left shift (<<): Multiplica por 2ⁿ
- Right shift (>>): Divide por 2ⁿ
Ejemplo: Check si numero es even
n & 1 == 0 means n es even
(Last bit determines odd/even)
Binary in Modern Computing
Memory Addresses
- 32-bit: Can address 2³² = 4 GB
- 64-bit: Can address 2⁶⁴ = 16 exabytes
Network Addresses
- IPv4: 32 bits (e.g., 192.168.1.1)
- IPv6: 128 bits
File Sizes
- All files son sequences of bytes
- File type determined by content/structure
Encryption
- AES uses 128, 192, o 256-bit keys
- SHA-256 produces 256-bit hashes
Conclusion
Binary es el/la language of todo digital sistemas porque electronic components naturally have two states. Every piece of digital datos—text, images, audio, video, programs—es ultimately represented as patterns of bits. Understanding binary illuminates como computers trabajar: desde el/la logic gates performing operations un/una el/la bytes storing characters un/una el/la bits flying across networks. While nosotros rarely interact with binary directly, eso underlies everything in el/la digital world.