mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-06 11:55:48 +00:00
(math-read-number-fancy): Read complement signed numbers.
(calc-init-extensions): Add binding for `calc-symclip'. Add autoloads for `calcFunc-symclip' and `calc-symclip'.
This commit is contained in:
parent
802732d033
commit
6f1b89435a
@ -198,6 +198,7 @@
|
||||
(define-key calc-mode-map "bo" 'calc-or)
|
||||
(define-key calc-mode-map "bp" 'calc-pack-bits)
|
||||
(define-key calc-mode-map "br" 'calc-rshift-binary)
|
||||
(define-key calc-mode-map "bs" 'calc-symclip)
|
||||
(define-key calc-mode-map "bt" 'calc-rotate-binary)
|
||||
(define-key calc-mode-map "bu" 'calc-unpack-bits)
|
||||
(define-key calc-mode-map "bw" 'calc-word-size)
|
||||
@ -762,7 +763,7 @@ math-quarter-integer math-round math-setup-declarations math-sqr
|
||||
math-sqr-float math-trunc-fancy math-trunc-special)
|
||||
|
||||
("calc-bin" calcFunc-and calcFunc-ash
|
||||
calcFunc-clip calcFunc-diff calcFunc-lsh calcFunc-not calcFunc-or
|
||||
calcFunc-clip calcFunc-diff calcFunc-symclip calcFunc-lsh calcFunc-not calcFunc-or
|
||||
calcFunc-rash calcFunc-rot calcFunc-rsh calcFunc-xor math-clip
|
||||
math-compute-max-digits math-convert-radix-digits math-float-parts
|
||||
math-format-bignum-binary math-format-bignum-hex
|
||||
@ -987,9 +988,9 @@ calc-find-root calc-poly-interp)
|
||||
calc-floor calc-idiv calc-increment calc-mant-part calc-max calc-min
|
||||
calc-round calc-scale-float calc-sign calc-trunc calc-xpon-part)
|
||||
|
||||
("calc-bin" calc-and calc-binary-radix calc-clip calc-decimal-radix
|
||||
calc-diff calc-hex-radix calc-leading-zeros calc-lshift-arith
|
||||
calc-lshift-binary calc-not calc-octal-radix calc-or calc-radix
|
||||
("calc-bin" calc-and calc-binary-radix calc-clip calc-complement-signed-mode
|
||||
calc-decimal-radix calc-diff calc-hex-radix calc-symclip calc-leading-zeros
|
||||
calc-lshift-arith calc-lshift-binary calc-not calc-octal-radix calc-or calc-radix
|
||||
calc-rotate-binary calc-rshift-arith calc-rshift-binary calc-word-size
|
||||
calc-xor)
|
||||
|
||||
@ -2994,10 +2995,20 @@ If X is not an error form, return 1."
|
||||
(math-add int (math-div frac (math-pow radix (length fracs))))))))
|
||||
|
||||
;; Integer with explicit radix
|
||||
((string-match "^\\([0-9]+\\)\\(#\\|\\^\\^\\)\\([0-9a-zA-Z]+\\)$" s)
|
||||
((string-match "^\\([0-9]+\\)\\(#&?\\|\\^\\^\\)\\([0-9a-zA-Z]+\\)$" s)
|
||||
(math-read-radix (math-match-substring s 3)
|
||||
(string-to-number (math-match-substring s 1))))
|
||||
|
||||
;; Complement signed with explicit radix
|
||||
((string-match "^\\([0-9]+\\)\\(##\\)\\([0-9a-zA-Z]+\\)$" s)
|
||||
(let ((num (math-read-radix (math-match-substring s 3)
|
||||
(string-to-number (math-match-substring s 1)))))
|
||||
(if (and
|
||||
(Math-lessp num math-2-word-size)
|
||||
(<= (math-compare math-half-2-word-size num) 0))
|
||||
(math-sub num math-2-word-size)
|
||||
num)))
|
||||
|
||||
;; C language hexadecimal notation
|
||||
((and (eq calc-language 'c)
|
||||
(string-match "^0[xX]\\([0-9a-fA-F]+\\)$" s))
|
||||
|
Loading…
Reference in New Issue
Block a user