
Binary Arithmetic by Hand: The Foundation Every Developer Should Understand
I had been writing code for three years before I actually understood what happens when you add two numbers in binary. I knew that computers used ones and zeros. I could vaguely wave my hands about bits and bytes. But if you had asked me to add 10110 and 01101 on a whiteboard, I would have stared at you blankly. Then I started debugging a networking issue involving subnet masks and bitwise operations, and my lack of foundational knowledge caught up with me hard. I spent two days on a problem that would have taken twenty minutes if I had understood binary arithmetic. Why Binary Exists Computers use binary because transistors have two stable states: on and off, high voltage and low voltage, 1 and 0. Everything your computer does -- every calculation, every pixel, every network packet -- is ultimately a sequence of binary operations performed on binary numbers. When you write let x = 42 in JavaScript, the computer stores the number 42 as 00101010 in memory. When you write x + 17 , the CPU
Continue reading on Dev.to Beginners
Opens in a new tab


