Calc Mode 1: Binary Numbers

Thanks to Andrew Hyatt for inspiring this entry

Here’s how to use Emacs to convert 8 numbers to binary. Why? Read on…

  1. Write the numbers: 127, 54, 32, 178, 199, 244, 3, 255
  2. Mark the region of the numbers and hit C-x * g. This grabs the numbers into calc mode as a vector
  3. In calc mode, hit d 2 to display the numbers in binary
  4. Still in calc mode, hit d z to show the leading zeroes. This shows them as 32 bit words
  5. Hit b w 8 to set the word size to 8 bits.
  6. Finally, and still in calc mode, hit y to yank the numbers back into the last buffer you were using.
  7. 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

  1. 01111111
  2. 00110110
  3. 00100000
  4. 10110010
  5. 11000111
  6. 11110100
  7. 00000011
  8. 11111111

1 Comment

  1. I have never implemented this tactic, many thanks for conveying it.

    Like

Leave a Comment