| Deep C Dives: All You Need Are Bits |
| Written by Mike James | |||||||
| Wednesday, 21 January 2026 | |||||||
Page 3 of 3
is one lot of 25, no lots of five and three ones, i.e. 28. This is how the Romans might have invented the place value system if only they hadn’t kept on inventing symbols for ever bigger groups. The only cost is having to maintain the positions of the symbols and invent a zero. The payback is that arithmetic is much easier as you can work with each position in turn. For example, to add the number of cars seen yesterday (27) to those seen today (23): 1 0 11 + or 50 in our notation. Notice that the addition was performed one “column” at a time and then counts that are too big are moved to the next column, the “carry”. This idea generalizes and if we work with groups of N and use the place value idea the first position counts from 0 to N-1, the second from N to Nx(N-1), the next to NxNx(N-1) and so on. We never need to use the symbol for N, but we do need a symbol for zero. Our standard system is base ten, for which we have ten digits, the symbols 0,1,2,3,4,5,6,7,8 and 9. In this base each place counts from 0 to 9 i.e. one less than 10 and there is no “digit” for 10. If you use all of the places then using just the first you can count from 0 to 9, using the first and the second gets you to 99 and using the third as well gets you to 999 and so on. A less familiar system, hexadecimal or base 16, works in exactly the same way. In this case there are 16 symbols 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F and again there is no symbol for 16. The first place counts from 0 to F i.e. 15, the second counts lots of 16 from 00 to F0 i.e. 0 to 240 and FF is 255. So now we understand how symbols can encode numbers. Next we need to look at how this works out using just 0 and 1 In book but not in this extract
Deep C Dives
|
Rue: Steve Klabnik In Collaboration with Claude 14/01/2026 Steve Klabnik, longtime contributor to the Rust language, is working on his own language, called Rue. This is a hobby project being done for fun and to speed up development Steve's co-worker is Claude [ ... ] |
Udacity Offers 40% Off 29/12/2025 Udacity is encouraging us to put the holiday time to good use with a special offer running until the New Year - 40% off across all its programs when you pay in advance. |
More News
|
Comments
or email your comment to: comments@i-programmer.info


