11.001001000011111101101010100010001000 Arithmazium
Home

Running in circles

Numbers in computer registers do not simply grow as we increase them. Instead, they run in circles. When they reach a maximum value, 11111111 in the case of the byte, they wrap arount to zero.

As you manipulate the slider below, which runs faster than the first example, think of the values running around the circle shown. Adding one moves you counterclockwise, and subtracting one move us clockwise. The blue numbers are the byte values in decimal.

------Image------

    
    


The byte has the value    as a number.

We should not be shocked by this behavior of byte registers in computers. We see it every day on our clocks, which wrap around every 12 hours on most U.S. clocks and every 24 hours on any clock. Especially on older cars with mechanical odometers, it's exciting to see the mileage 99,999.9 roll over to 00,000.0

In the previous sections on basic byte arithmetic, we introduced the concept of modular arithmetic. In basic byte arithmetic, all operations are performed modulo \( 256 \). When the computer lops off all bits beyond the 8 bits of a byte, it effective removes all multiples of \( 256 \), reducing the value to the range \( 0 \) to \( 255 \).

Home