1 ;; Calculator for GNU Emacs, part I [calc-misc.el]
2 ;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
3 ;; Written by Dave Gillespie, daveg@synaptics.com.
5 ;; This file is part of GNU Emacs.
7 ;; GNU Emacs is distributed in the hope that it will be useful,
8 ;; but WITHOUT ANY WARRANTY. No author or distributor
9 ;; accepts responsibility to anyone for the consequences of using it
10 ;; or for whether it serves any particular purpose or works at all,
11 ;; unless he says so in writing. Refer to the GNU Emacs General Public
12 ;; License for full details.
14 ;; Everyone is granted permission to copy, modify and redistribute
15 ;; GNU Emacs, but only under the conditions described in the
16 ;; GNU Emacs General Public License. A copy of this license is
17 ;; supposed to have been given to you along with GNU Emacs so you
18 ;; can know your rights and responsibilities. It should be in a
19 ;; file named COPYING. Among other things, the copyright notice
20 ;; and this notice must be preserved on all copies.
24 ;; This file is autoloaded from calc.el.
29 (defun calc-Need-calc-misc () nil)
32 (defun calc-dispatch-help (arg)
33 "M-# is a prefix key; follow it with one of these letters:
35 For turning Calc on and off:
36 C calc. Start the Calculator in a window at the bottom of the screen.
37 O calc-other-window. Start the Calculator but don't select its window.
38 B calc-big-or-small. Control whether to use the full Emacs screen for Calc.
39 Q quick-calc. Use the Calculator in the minibuffer.
40 K calc-keypad. Start the Calculator in keypad mode (X window system only).
41 E calc-embedded. Use the Calculator on a formula in this editing buffer.
42 J calc-embedded-select. Like E, but select appropriate half of => or :=.
43 W calc-embedded-word. Like E, but activate a single word, i.e., a number.
44 Z calc-user-invocation. Invoke Calc in the way you defined with `Z I' cmd.
45 X calc-quit. Turn Calc off.
47 For moving data into and out of Calc:
48 G calc-grab-region. Grab the region defined by mark and point into Calc.
49 R calc-grab-rectangle. Grab the rectangle defined by mark, point into Calc.
50 : calc-grab-sum-down. Grab a rectangle and sum the columns.
51 _ calc-grab-sum-across. Grab a rectangle and sum the rows.
52 Y calc-copy-to-buffer. Copy a value from the stack into the editing buffer.
54 For use with Embedded mode:
55 A calc-embedded-activate. Find and activate all :='s and =>'s in buffer.
56 D calc-embedded-duplicate. Make a copy of this formula and select it.
57 F calc-embedded-new-formula. Insert a new formula at current point.
58 N calc-embedded-next. Advance cursor to next known formula in buffer.
59 P calc-embedded-previous. Advance cursor to previous known formula.
60 U calc-embedded-update-formula. Re-evaluate formula at point.
61 ` calc-embedded-edit. Use calc-edit to edit formula at point.
64 I calc-info. Read the Calculator manual in the Emacs Info system.
65 T calc-tutorial. Run the Calculator Tutorial using the Emacs Info system.
66 S calc-summary. Read the Summary from the Calculator manual in Info.
69 L calc-load-everything. Load all parts of the Calculator into memory.
70 M read-kbd-macro. Read a region of keystroke names as a keyboard macro.
71 0 (zero) calc-reset. Reset Calc stack and modes to default state.
73 Press twice (`M-# M-#' or `M-# #') to turn Calc on or off using the same
74 Calc user interface as before (either M-# C or M-# K; initially M-# C)."
77 (if calc-dispatch-help
79 (save-window-excursion
80 (describe-function 'calc-dispatch-help)
81 (let ((win (get-buffer-window "*Help*")))
86 (message "Calc options: Calc, Keypad, ... %s"
87 "press SPC, DEL to scroll, C-g to cancel")
88 (memq (car (setq key (calc-read-key t)))
89 '(? ?\C-h ?\C-? ?\C-v ?\M-v)))
91 (if (memq (car key) '(? ?\C-v))
95 (calc-unread-command (cdr key))))))
96 (calc-do-dispatch nil))
97 (let ((calc-dispatch-help t))
98 (calc-do-dispatch arg)))
102 (defun calc-big-or-small (arg)
103 "Toggle Calc between full-screen and regular mode."
105 (let ((cwin (get-buffer-window "*Calculator*"))
106 (twin (get-buffer-window "*Calc Trail*"))
107 (kwin (get-buffer-window "*Calc Keypad*")))
111 (and twin (eq (window-width twin) (frame-width)))
112 (eq (window-height cwin) (1- (frame-height))))))
113 (setq calc-full-mode (if arg
114 (> (prefix-numeric-value arg) 0)
115 (not calc-full-mode)))
119 (calc-do-keypad calc-full-mode nil))
123 (calc nil calc-full-mode nil))))
124 (message (if calc-full-mode
125 "Now using full screen for Calc."
126 "Now using partial screen for Calc.")))
129 (defun calc-other-window ()
130 "Invoke the Calculator in another window."
132 (if (memq major-mode '(calc-mode calc-trail-mode))
135 (if (memq major-mode '(calc-mode calc-trail-mode))
137 (if (get-buffer-window "*Calculator*")
139 (let ((win (selected-window)))
140 (calc nil win (interactive-p)))))
143 (defun another-calc ()
144 "Create another, independent Calculator buffer."
146 (if (eq major-mode 'calc-mode)
149 (set-default v (symbol-value v)))) calc-local-var-list))
150 (set-buffer (generate-new-buffer "*Calculator*"))
151 (pop-to-buffer (current-buffer))
156 ;;; Make an attempt to preserve the window configuration, while deleting
157 ;;; windows on "bufs". Emacs 19's delete-window function will probably
158 ;;; make this kludgery unnecessary, but Emacs 18's tendency to grow all
159 ;;; windows on the screen to take up the slack from the deleted windows
160 ;;; can be annoying when Calc was called during another multi-window
161 ;;; application, such as GNUS.
163 (defun calc-delete-windows-keep (&rest bufs)
165 (mapcar 'delete-windows-on bufs)
166 (let* ((w (car calc-was-split))
171 (setq w2 (previous-window w)
172 e2 (window-edges w2))
173 (and (= (car e2) (car e))
174 (= (nth 2 e2) (nth 2 e))
175 (< (nth 1 e2) (nth 1 e))))
179 (setq wins (cons (list w (nth 1 e) (window-buffer w)
180 (window-point w) (window-start w))
186 (= (nth 2 e2) (nth 2 e)))))
187 (setq wins (nreverse wins))
188 (mapcar 'delete-windows-on bufs)
193 (sel (if (window-point (nth 2 calc-was-split))
194 (nth 2 calc-was-split)
197 (if (window-point (car (car w)))
199 (delete-window (car (car w)))
200 (setq main (car (car w))
201 mainpos (nth 1 (car w))
203 (setq wins (delq (car w) wins)))
206 (setq w (split-window main
207 (if (eq main (car calc-was-split))
208 (nth 1 calc-was-split)
209 (- (nth 1 (car wins)) mainpos))))
210 (set-window-buffer w (nth 2 (car wins)))
211 (set-window-point w (nth 3 (car wins)))
212 (set-window-start w (nth 4 (car wins)))
213 (if (eq sel (car (car wins)))
216 mainpos (nth 1 (car wins))
218 (if (window-point sel)
219 (select-window sel))))))
224 "Run the Emacs Info system on the Calculator documentation."
227 (select-window (get-largest-window))
228 (or calc-emacs-type-lucid
229 (file-name-absolute-p calc-info-filename)
232 (if (boundp 'Info-directory)
233 (setq p (cons Info-directory p)))
234 (while (and p (not (file-exists-p
235 (setq name (expand-file-name calc-info-filename
238 (if p (setq calc-info-filename name))))
242 (or (and (boundp 'Info-current-file)
243 (stringp Info-current-file)
244 (string-match "calc" Info-current-file))
245 (Info-find-node calc-info-filename "Top"))
249 (defun calc-tutorial ()
250 "Run the Emacs Info system on the Calculator Tutorial."
252 (if (get-buffer-window "*Calculator*")
255 (Info-goto-node "Interactive Tutorial")
257 (message "Welcome to the Calc Tutorial!")
260 (defun calc-info-summary ()
261 "Run the Emacs Info system on the Calculator Summary."
264 (Info-goto-node "Summary")
270 '("Press `h' for complete help; press `?' repeatedly for a summary"
271 "Letter keys: Negate; Precision; Yank; Why; Xtended cmd; Quit"
272 "Letter keys: SHIFT + Undo, reDo; Keep-args; Inverse, Hyperbolic"
273 "Letter keys: SHIFT + sQrt; Sin, Cos, Tan; Exp, Ln, logB"
274 "Letter keys: SHIFT + Floor, Round; Abs, conJ, arG; Pi"
275 "Letter keys: SHIFT + Num-eval; More-recn; eXec-kbd-macro"
276 "Other keys: +, -, *, /, ^, \\ (int div), : (frac div)"
277 "Other keys: & (1/x), | (concat), % (modulo), ! (factorial)"
278 "Other keys: ' (alg-entry), = (eval), ` (edit); M-RET (last-args)"
279 "Other keys: SPC/RET (enter/dup), LFD (over); < > (scroll horiz)"
280 "Other keys: DEL (drop), M-DEL (drop-above); { } (scroll vert)"
281 "Other keys: TAB (swap/roll-dn), M-TAB (roll-up)"
282 "Other keys: [ , ; ] (vector), ( , ) (complex), ( ; ) (polar)"
283 "Prefix keys: Algebra, Binary/business, Convert, Display"
284 "Prefix keys: Functions, Graphics, Help, J (select)"
285 "Prefix keys: Kombinatorics/statistics, Modes, Store/recall"
286 "Prefix keys: Trail/time, Units/statistics, Vector/matrix"
287 "Prefix keys: Z (user), SHIFT + Z (define)"
288 "Prefix keys: prefix + ? gives further help for that prefix")
290 " Calc %s by Dave Gillespie, daveg@synaptics.com"
292 (if calc-full-help-flag
294 (if (or calc-inverse-flag calc-hyperbolic-flag)
295 (if calc-inverse-flag
296 (if calc-hyperbolic-flag
297 (calc-inv-hyp-prefix-help)
298 (calc-inverse-prefix-help))
299 (calc-hyperbolic-prefix-help))
300 (setq calc-help-phase
301 (if (eq this-command last-command)
302 (% (1+ calc-help-phase) (1+ (length msgs)))
304 (let ((msg (nth calc-help-phase msgs)))
305 (message "%s" (if msg
307 (make-string (- (apply 'max
318 ;;;; Stack and buffer management.
321 (defun calc-do-handle-whys ()
322 (setq calc-why (sort calc-next-why
325 (and (eq (car x) '*) (not (eq (car y) '*))))))
327 (if (and calc-why (or (eq calc-auto-why t)
328 (and (eq (car (car calc-why)) '*)
332 (calc-explain-why (car calc-why)
333 (if (eq calc-auto-why t)
336 (eq (car (nth 1 calc-why)) '*))))
337 (setq calc-last-why-command this-command)
338 (calc-clear-command-flag 'clear-message)))
341 (defun calc-record-why (&rest stuff)
342 (if (eq (car stuff) 'quiet)
343 (setq stuff (cdr stuff))
344 (if (and (symbolp (car stuff))
346 (or (Math-objectp (nth 1 stuff))
347 (and (Math-vectorp (nth 1 stuff))
348 (math-constp (nth 1 stuff)))
349 (math-infinitep (nth 1 stuff))))
350 (setq stuff (cons '* stuff))
351 (if (and (stringp (car stuff))
352 (string-match "\\`\\*" (car stuff)))
353 (setq stuff (cons '* (cons (substring (car stuff) 1)
355 (setq calc-next-why (cons stuff calc-next-why))
359 ;;; True if A is a constant or vector of constants. [P x] [Public]
360 (defun math-constp (a)
362 (and (memq (car a) '(sdev intv mod vec))
364 (while (and (setq a (cdr a))
365 (or (Math-scalarp (car a)) ; optimization
366 (math-constp (car a)))))
371 (defun calc-roll-down-stack (n &optional m)
373 (calc-roll-up-stack (- n) m)
374 (if (or (= n 0) (> n (calc-stack-size))) (setq n (calc-stack-size)))
378 (if (and calc-any-selections
379 (not calc-use-selections))
380 (calc-roll-down-with-selections n m)
381 (calc-pop-push-list n
382 (append (calc-top-list m 1)
383 (calc-top-list (- n m) (1+ m)))))))
386 (defun calc-roll-up-stack (n &optional m)
388 (calc-roll-down-stack (- n) m)
389 (if (or (= n 0) (> n (calc-stack-size))) (setq n (calc-stack-size)))
393 (if (and calc-any-selections
394 (not calc-use-selections))
395 (calc-roll-up-with-selections n m)
396 (calc-pop-push-list n
397 (append (calc-top-list (- n m) 1)
398 (calc-top-list m (- n m -1)))))))
402 (defun calc-do-refresh ()
403 (if calc-hyperbolic-flag
405 (setq calc-display-dirty t)
412 (defun calc-record-list (vals &optional prefix)
414 (or (eq (car vals) 'top-of-stack)
416 (calc-record (car vals) prefix)
417 (setq prefix "...")))
418 (setq vals (cdr vals)))
422 (defun calc-last-args-stub (arg)
429 (defun calc-power (arg)
432 (if (and calc-extensions-loaded
434 (calc-binary-op "root" 'calcFunc-nroot arg nil nil)
435 (calc-binary-op "^" 'calcFunc-pow arg nil nil '^)))
438 (defun calc-mod (arg)
441 (calc-binary-op "%" 'calcFunc-mod arg nil nil '%))
444 (defun calc-inv (arg)
447 (calc-unary-op "inv" 'calcFunc-inv arg))
450 (defun calc-percent ()
453 (calc-pop-push-record-list
454 1 "%" (list (list 'calcFunc-percent (calc-top-n 1)))))
461 (calc-enter (- (prefix-numeric-value n)))
466 (defun calc-pop-above (n)
469 (calc-pop (- (prefix-numeric-value n)))
473 (defun calc-roll-down (n)
476 (let ((nn (prefix-numeric-value n)))
478 (calc-roll-down-stack 2))
480 (calc-roll-down-stack nn))
482 (calc-pop-push-list (calc-stack-size)
484 (calc-top-list (calc-stack-size)))))
486 (calc-roll-down-stack (calc-stack-size) (- nn))))))
489 (defun calc-roll-up (n)
492 (let ((nn (prefix-numeric-value n)))
494 (calc-roll-up-stack 3))
496 (calc-roll-up-stack nn))
498 (calc-pop-push-list (calc-stack-size)
500 (calc-top-list (calc-stack-size)))))
502 (calc-roll-up-stack (calc-stack-size) (- nn))))))
510 (defun calc-num-prefix-name (n)
511 (cond ((eq n '-) "- ")
512 ((equal n '(4)) "C-u ")
513 ((consp n) (format "%d " (car n)))
514 ((integerp n) (format "%d " n))
518 (defun calc-missing-key (n)
519 "This is a placeholder for a command which needs to be loaded from calc-ext.
520 When this key is used, calc-ext (the Calculator extensions module) will be
521 loaded and the keystroke automatically re-typed."
524 (if (keymapp (key-binding (char-to-string last-command-char)))
525 (message "%s%c-" (calc-num-prefix-name n) last-command-char))
526 (calc-unread-command)
530 (defun calc-shift-Y-prefix-help ()
533 (calc-do-prefix-help calc-Y-help-msgs "other" ?Y)
539 (defun calcDigit-letter ()
541 (if (calc-minibuffer-contains "[-+]?\\(1[1-9]\\|[2-9][0-9]\\)#.*")
543 (setq last-command-char (upcase last-command-char))
545 (calcDigit-nondigit))
549 ;; A Lisp version of temp_minibuffer_message from minibuf.c.
550 (defun calc-temp-minibuffer-message (m)
551 (let ((savemax (point-max)))
553 (goto-char (point-max))
559 (identity 1) ; this forces a call to QUIT; in bytecode.c.
562 (delete-region savemax (point-max))
563 (or okay (abort-recursive-edit))))))
567 (put 'math-with-extra-prec 'lisp-indent-hook 1)
570 ;;; Concatenate two vectors, or a vector and an object. [V O O] [Public]
571 (defun math-concat (v1 v2)
575 (if (and (or (math-objvecp v1) (math-known-scalarp v1))
576 (or (math-objvecp v2) (math-known-scalarp v2)))
577 (append (if (and (math-vectorp v1)
578 (or (math-matrixp v1)
579 (not (math-matrixp v2))))
582 (if (and (math-vectorp v2)
583 (or (math-matrixp v2)
584 (not (math-matrixp v1))))
591 ;;; True if A is zero. Works for un-normalized values. [P n] [Public]
592 (defun math-zerop (a)
594 (cond ((memq (car a) '(bigpos bigneg))
595 (while (eq (car (setq a (cdr a))) 0))
597 ((memq (car a) '(frac float polar mod))
598 (math-zerop (nth 1 a)))
600 (and (math-zerop (nth 1 a)) (math-zerop (nth 2 a))))
602 (and (math-zerop (nth 1 a))
603 (math-zerop (nth 2 a))
604 (math-zerop (nth 3 a)))))
609 ;;; True if A is real and negative. [P n] [Public]
613 (cond ((eq (car a) 'bigpos) nil)
614 ((eq (car a) 'bigneg) (cdr a))
615 ((memq (car a) '(float frac))
616 (Math-integer-negp (nth 1 a)))
618 (if (math-zerop (nth 1 a))
619 (if (math-zerop (nth 2 a))
620 (math-negp (nth 3 a))
621 (math-negp (nth 2 a)))
622 (math-negp (nth 1 a))))
624 (math-negp (nth 1 a)))
626 (or (math-negp (nth 3 a))
627 (and (math-zerop (nth 3 a))
628 (memq (nth 1 a) '(0 2)))))
629 ((equal a '(neg (var inf var-inf))) t))
633 ;;; True if A is a negative number or an expression the starts with '-'.
634 (defun math-looks-negp (a) ; [P x] [Public]
636 (eq (car-safe a) 'neg)
637 (and (memq (car-safe a) '(* /))
638 (or (math-looks-negp (nth 1 a))
639 (math-looks-negp (nth 2 a))))
640 (and (eq (car-safe a) '-)
641 (math-looks-negp (nth 1 a))))
645 ;;; True if A is real and positive. [P n] [Public]
648 (cond ((eq (car a) 'bigpos) (cdr a))
649 ((eq (car a) 'bigneg) nil)
650 ((memq (car a) '(float frac))
651 (Math-integer-posp (nth 1 a)))
653 (if (math-zerop (nth 1 a))
654 (if (math-zerop (nth 2 a))
655 (math-posp (nth 3 a))
656 (math-posp (nth 2 a)))
657 (math-posp (nth 1 a))))
659 (math-posp (nth 1 a)))
661 (not (math-zerop (nth 1 a))))
663 (or (math-posp (nth 2 a))
664 (and (math-zerop (nth 2 a))
665 (memq (nth 1 a) '(0 1)))))
666 ((equal a '(var inf var-inf)) t))
670 (fset 'math-fixnump (symbol-function 'integerp))
671 (fset 'math-fixnatnump (symbol-function 'natnump))
674 ;;; True if A is an even integer. [P R R] [Public]
675 (defun math-evenp (a)
677 (and (memq (car a) '(bigpos bigneg))
678 (= (% (nth 1 a) 2) 0))
682 ;;; Compute A / 2, for small or big integer A. [I i]
683 ;;; If A is negative, type of truncation is undefined.
687 (math-normalize (cons (car a) (math-div2-bignum (cdr a))))
692 (defun math-div2-bignum (a) ; [l l]
694 (cons (+ (/ (car a) 2) (* (% (nth 1 a) 2) 500))
695 (math-div2-bignum (cdr a)))
696 (list (/ (car a) 2)))
700 ;;; Reject an argument to a calculator function. [Public]
701 (defun math-reject-arg (&optional a p option)
703 (calc-record-why option p a)
705 (calc-record-why p a)))
706 (signal 'wrong-type-argument (and a (if p (list p a) (list a))))
710 ;;; Coerce A to be an integer (by truncation toward zero). [I N] [Public]
711 (defun math-trunc (a &optional prec)
714 (math-trunc-special a prec))
715 ((Math-integerp a) a)
717 (math-neg (math-trunc (math-neg a))))
719 (math-scale-int (nth 1 a) (nth 2 a)))
721 (math-trunc-fancy a)))
723 (fset 'calcFunc-trunc (symbol-function 'math-trunc))
725 ;;; Coerce A to be an integer (by truncation toward minus infinity). [I N]
726 (defun math-floor (a &optional prec) ; [Public]
729 (math-floor-special a prec))
730 ((Math-integerp a) a)
731 ((Math-messy-integerp a) (math-trunc a))
734 (math-add (math-trunc a) -1)
737 (math-floor-fancy a)))
739 (fset 'calcFunc-floor (symbol-function 'math-floor))
742 (defun math-imod (a b) ; [I I I] [Public]
743 (if (and (not (consp a)) (not (consp b)))
745 (math-reject-arg a "*Division by zero")
747 (cdr (math-idivmod a b)))
751 (defun calcFunc-inv (m)
755 (if (math-square-matrixp m)
756 (or (math-with-extra-prec 2 (math-matrix-inv-raw m))
757 (math-reject-arg m "*Singular matrix"))
758 (math-reject-arg m 'square-matrixp)))
763 (defun math-do-working (msg arg)
764 (or executing-kbd-macro
766 (calc-set-command-flag 'clear-message)
767 (if math-working-step
768 (if math-working-step-2
769 (setq msg (format "[%d/%d] %s"
770 math-working-step math-working-step-2 msg))
771 (setq msg (format "[%d] %s" math-working-step msg))))
772 (message "Working... %s = %s" msg
773 (math-showing-full-precision (math-format-number arg)))))
777 ;;; Compute A modulo B, defined in terms of truncation toward minus infinity.
778 (defun math-mod (a b) ; [R R R] [Public]
779 (cond ((and (Math-zerop a) (not (eq (car-safe a) 'mod))) a)
781 (math-reject-arg a "*Division by zero"))
782 ((and (Math-natnump a) (Math-natnump b))
784 ((and (Math-anglep a) (Math-anglep b))
785 (math-sub a (math-mul (math-floor (math-div a b)) b)))
787 (math-mod-fancy a b)))
792 ;;; General exponentiation.
794 (defun math-pow (a b) ; [O O N] [Public]
795 (cond ((equal b '(var nan var-nan))
798 (if (and (Math-scalarp b) (Math-posp b))
799 (if (math-floatp b) (math-float a) a)
801 (math-pow-of-zero a b)))
802 ((or (eq a 1) (eq b 1)) a)
803 ((or (equal a '(float 1 0)) (equal b '(float 1 0))) a)
806 (if (or (math-floatp a) (math-floatp b))
809 (math-pow-zero a b)))
810 ((and (Math-integerp b) (or (Math-numberp a) (Math-vectorp a)))
811 (if (and (equal a '(float 1 1)) (integerp b))
812 (math-make-float 1 b)
813 (math-with-extra-prec 2
817 (math-pow-fancy a b)))
820 (defun math-ipow (a n) ; [O O I] [Public]
821 (cond ((Math-integer-negp n)
822 (math-ipow (math-div 1 a) (Math-integer-neg n)))
824 (if (and (Math-ratp a) (> n 20))
825 (math-iipow-show a n)
828 (math-ipow (math-mul a a) (math-div2 n)))
830 (math-mul a (math-ipow (math-mul a a)
831 (math-div2 (math-add n -1))))))
834 (defun math-iipow (a n) ; [O O S]
837 ((= (% n 2) 0) (math-iipow (math-mul a a) (/ n 2)))
838 (t (math-mul a (math-iipow (math-mul a a) (/ n 2)))))
841 (defun math-iipow-show (a n) ; [O O S]
842 (math-working "pow" a)
846 ((= (% n 2) 0) (math-iipow-show (math-mul a a) (/ n 2)))
847 (t (math-mul a (math-iipow-show (math-mul a a) (/ n 2)))))))
848 (math-working "pow" val)
853 (defun math-read-radix-digit (dig) ; [D S; Z S]
869 (defun report-calc-bug (topic)
870 "Report a bug in Calc, the GNU Emacs calculator.
871 Prompts for bug subject. Leaves you in a mail buffer."
872 (interactive "sBug Subject: ")
873 (mail nil calc-bug-address topic)
874 (goto-char (point-max))
875 (insert "\nIn Calc " calc-version ", Emacs " (emacs-version) "\n\n")
876 (message (substitute-command-keys "Type \\[mail-send] to send bug report."))
878 (fset 'calc-report-bug (symbol-function 'report-calc-bug))