All pastes #927886 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-03-04 16:48 UTC
rendered paste body
BIN-UTILS> (let ((bin '(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1)))
	     (dotimes (i 15)
	       (when (> i 0)
		 (format t "2 ^ ~A = ~A~%" i (bin-to-dec (<<bin bin :times i))))))
2 ^ 1 = 2
2 ^ 2 = 4
2 ^ 3 = 8
2 ^ 4 = 16
2 ^ 5 = 32
2 ^ 6 = 64
2 ^ 7 = 128
2 ^ 8 = 256
2 ^ 9 = 512
2 ^ 10 = 1024
2 ^ 11 = 2048
2 ^ 12 = 4096
2 ^ 13 = 8192
2 ^ 14 = 16384
NIL
BIN-UTILS> (let ((bin '(1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)))
	     (dotimes (i 15)
	       (when (> i 0)
		 (format t "2 ^ ~A = ~A~%" i (bin-to-dec (<<bin bin :times i))))))
2 ^ 1 = -2
2 ^ 2 = -4
2 ^ 3 = -8
2 ^ 4 = -16
2 ^ 5 = -32
2 ^ 6 = -64
2 ^ 7 = -128
2 ^ 8 = -256
2 ^ 9 = -512
2 ^ 10 = -1024
2 ^ 11 = -2048
2 ^ 12 = -4096
2 ^ 13 = -8192
2 ^ 14 = -16384
NIL