Thanks to Andrew Hyatt for inspiring this entry
Here’s how to use Emacs to convert 8 numbers to binary. Why? Read on…
- Write the numbers: 127, 54, 32, 178, 199, 244, 3, 255
- Mark the region of the numbers and hit C-x * g. This grabs the numbers into calc mode as a vector
- In calc mode, hit d 2 to display the numbers in binary
- Still in calc mode, hit d z to show the leading zeroes. This shows them as 32 bit words
- Hit b w 8 to set the word size to 8 bits.
- Finally, and still in calc mode, hit y to yank the numbers back into the last buffer you were using.
- Add a table, tidy things up, and you’ve got a worksheet like the one below for a set of students and the answers for yourself.
Convert the 8 bit unsigned numbers to denary