Sunday, October 30, 2011

print a binary number in octal using emacs lisp

(format "%o" #b10110)

As in the emacs lisp reference (info page),
#b is for binary numbers
#o is for octal numbers

After you define something, you can just print it with format. With %o for octal, %d as decimal, and %x for hexadecimal.

You can print numbers to binary using calc mode (M-x calc)
the number

No comments:

Post a Comment