Mercurial > emacs
changeset 106137:0e720bab47c6
(math-format-twos-complement): Renamed from math-format-complement-signed.
(calc-radix): Rename `calc-complement-signed-mode' to
`calc-twos-complement-mode'.
(calc-octal-radix, calc-hex-radix): Add an argument for two's complement.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Fri, 20 Nov 2009 00:55:53 +0000 |
parents | 72136220d7f5 |
children | 18198cdc91fa |
files | lisp/calc/calc-bin.el |
diffstat | 1 files changed, 13 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/calc/calc-bin.el Fri Nov 20 00:55:13 2009 +0000 +++ b/lisp/calc/calc-bin.el Fri Nov 20 00:55:53 2009 +0000 @@ -159,7 +159,7 @@ (calc-do-refresh) (calc-refresh-evaltos) (if (< n 0) - (message "Binary word size is %d bits (2's complement)" (- n)) + (message "Binary word size is %d bits (two's complement)" (- n)) (message "Binary word size is %d bits" n)))) @@ -174,13 +174,13 @@ (if (and (>= n 2) (<= n 36)) (progn (calc-change-mode - (list 'calc-number-radix 'calc-complement-signed-mode) - (list n (and (= n 2) arg)) t) + (list 'calc-number-radix 'calc-twos-complement-mode) + (list n (and (or (= n 2) (= n 8) (= n 16)) arg)) t) ;; also change global value so minibuffer sees it (setq-default calc-number-radix calc-number-radix)) (setq n calc-number-radix)) - (if calc-complement-signed-mode - (message "Number radix is %d, complement signed mode is on." n) + (if calc-twos-complement-mode + (message "Number radix is %d, two's complement mode is on." n) (message "Number radix is %d" n)))) (defun calc-decimal-radix () @@ -191,13 +191,13 @@ (interactive "P") (calc-radix 2 arg)) -(defun calc-octal-radix () - (interactive) - (calc-radix 8)) +(defun calc-octal-radix (&optional arg) + (interactive "P") + (calc-radix 8 arg)) -(defun calc-hex-radix () - (interactive) - (calc-radix 16)) +(defun calc-hex-radix (&optional arg) + (interactive "P") + (calc-radix 16 arg)) (defun calc-leading-zeros (n) (interactive "P") @@ -820,9 +820,9 @@ calc-number-radix)))))) math-radix-float-cache)))))))) -;;; Complement signed mode +;;; Two's complement mode -(defun math-format-complement-signed (a) +(defun math-format-twos-complement (a) "Format an integer in complement signed mode." (let* (;(calc-leading-zeros t) (overflow nil)