Chris DeLuca's webbed site

πŸ“– ✏️ Learning to Program in C

by Thomas Plum

Started reading on

Binary integers

To calculate binary integers, assign each number an incrementing value, working right to left. The increment doubles the previous value, starting at 1. For example 1, 2, 4, 8, 16, 32, and so on. Isolate every one of those values represented by a 1, ignoring 0, and add all those together. That is the integer value.

10010101

  1| 0| 0| 1|0|1|0|1
128|  |  |16| |4| |1

128 + 16 + 4 + 1 = 149

In signed values, the far left bit (high-order bit) is the negative/positive number indicator. If that bit is 0, the number is positive, 1 and it's negative.