Mercurial > emacs
comparison lisp/calc/calc.el @ 106135:44eb0cd5515b
(calc-set-mode-line): Rename `calc-complement-signed-mode' to
`calc-twos-complement-mode'.
(math-format-number): Rename `math-format-complement-signed' to
`math-format-twos-complement'.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Fri, 20 Nov 2009 00:54:19 +0000 |
parents | 20558a815b94 |
children | 1d1d5d9bd884 |
comparison
equal
deleted
inserted
replaced
106134:cff2b8b6d64e | 106135:44eb0cd5515b |
---|---|
206 (declare-function math-stack-value-offset-fancy "calccomp" ()) | 206 (declare-function math-stack-value-offset-fancy "calccomp" ()) |
207 (declare-function math-format-flat-expr-fancy "calc-ext" (a prec)) | 207 (declare-function math-format-flat-expr-fancy "calc-ext" (a prec)) |
208 (declare-function math-adjust-fraction "calc-ext" (a)) | 208 (declare-function math-adjust-fraction "calc-ext" (a)) |
209 (declare-function math-format-binary "calc-bin" (a)) | 209 (declare-function math-format-binary "calc-bin" (a)) |
210 (declare-function math-format-radix "calc-bin" (a)) | 210 (declare-function math-format-radix "calc-bin" (a)) |
211 (declare-function math-format-complement-signed "calc-bin" (a)) | 211 (declare-function math-format-twos-complement "calc-bin" (a)) |
212 (declare-function math-group-float "calc-ext" (str)) | 212 (declare-function math-group-float "calc-ext" (str)) |
213 (declare-function math-mod "calc-misc" (a b)) | 213 (declare-function math-mod "calc-misc" (a b)) |
214 (declare-function math-format-number-fancy "calc-ext" (a prec)) | 214 (declare-function math-format-number-fancy "calc-ext" (a prec)) |
215 (declare-function math-format-bignum-fancy "calc-ext" (a)) | 215 (declare-function math-format-bignum-fancy "calc-ext" (a)) |
216 (declare-function math-read-number-fancy "calc-ext" (s)) | 216 (declare-function math-read-number-fancy "calc-ext" (s)) |
688 If a number, variables are assumed to be NxN matrices. | 688 If a number, variables are assumed to be NxN matrices. |
689 If `sqmatrix', variables are assumed to be square matrices of an unspecified size. | 689 If `sqmatrix', variables are assumed to be square matrices of an unspecified size. |
690 If `scalar', variables are assumed to be scalar-valued. | 690 If `scalar', variables are assumed to be scalar-valued. |
691 If nil, symbolic math routines make no assumptions about variables.") | 691 If nil, symbolic math routines make no assumptions about variables.") |
692 | 692 |
693 (defcalcmodevar calc-complement-signed-mode nil | 693 (defcalcmodevar calc-twos-complement-mode nil |
694 "If non-nil, display integers in complement signed mode.") | 694 "If non-nil, display integers in two's complement mode.") |
695 | 695 |
696 | 696 |
697 (defcalcmodevar calc-shift-prefix nil | 697 (defcalcmodevar calc-shift-prefix nil |
698 "If non-nil, shifted letter keys are prefix keys rather than normal meanings.") | 698 "If non-nil, shifted letter keys are prefix keys rather than normal meanings.") |
699 | 699 |
1708 (cond ((= calc-number-radix 10) "") | 1708 (cond ((= calc-number-radix 10) "") |
1709 ((= calc-number-radix 2) "Bin ") | 1709 ((= calc-number-radix 2) "Bin ") |
1710 ((= calc-number-radix 8) "Oct ") | 1710 ((= calc-number-radix 8) "Oct ") |
1711 ((= calc-number-radix 16) "Hex ") | 1711 ((= calc-number-radix 16) "Hex ") |
1712 (t (format "Radix%d " calc-number-radix))) | 1712 (t (format "Radix%d " calc-number-radix))) |
1713 (if calc-complement-signed-mode "CompSign " "") | 1713 (if calc-twos-complement-mode "TwosComp " "") |
1714 (if calc-leading-zeros "Zero " "") | 1714 (if calc-leading-zeros "Zero " "") |
1715 (cond ((null calc-language) "") | 1715 (cond ((null calc-language) "") |
1716 ((get calc-language 'math-lang-name) | 1716 ((get calc-language 'math-lang-name) |
1717 (concat (get calc-language 'math-lang-name) " ")) | 1717 (concat (get calc-language 'math-lang-name) " ")) |
1718 (t (concat | 1718 (t (concat |
3391 ;;; Format a number as a string. | 3391 ;;; Format a number as a string. |
3392 (defvar math-half-2-word-size) | 3392 (defvar math-half-2-word-size) |
3393 (defun math-format-number (a &optional prec) ; [X N] [Public] | 3393 (defun math-format-number (a &optional prec) ; [X N] [Public] |
3394 (cond | 3394 (cond |
3395 ((eq calc-display-raw t) (format "%s" a)) | 3395 ((eq calc-display-raw t) (format "%s" a)) |
3396 ((and calc-complement-signed-mode | 3396 ((and calc-twos-complement-mode |
3397 math-radix-explicit-format | 3397 math-radix-explicit-format |
3398 (Math-integerp a) | 3398 (Math-integerp a) |
3399 (or (eq a 0) | 3399 (or (eq a 0) |
3400 (and (Math-integer-posp a) | 3400 (and (Math-integer-posp a) |
3401 (Math-lessp a math-half-2-word-size)) | 3401 (Math-lessp a math-half-2-word-size)) |
3404 (let ((comparison | 3404 (let ((comparison |
3405 (math-compare (Math-integer-neg a) math-half-2-word-size))) | 3405 (math-compare (Math-integer-neg a) math-half-2-word-size))) |
3406 (or (= comparison 0) | 3406 (or (= comparison 0) |
3407 (= comparison -1)))))) | 3407 (= comparison -1)))))) |
3408 (require 'calc-bin) | 3408 (require 'calc-bin) |
3409 (math-format-complement-signed a)) | 3409 (math-format-twos-complement a)) |
3410 ((and (nth 1 calc-frac-format) (Math-integerp a)) | 3410 ((and (nth 1 calc-frac-format) (Math-integerp a)) |
3411 (require 'calc-ext) | 3411 (require 'calc-ext) |
3412 (math-format-number (math-adjust-fraction a))) | 3412 (math-format-number (math-adjust-fraction a))) |
3413 ((integerp a) | 3413 ((integerp a) |
3414 (if (not (or calc-group-digits calc-leading-zeros)) | 3414 (if (not (or calc-group-digits calc-leading-zeros)) |