Variable: calc-arithmetic-menu

calc-arithmetic-menu is a variable defined in calc-menu.el.gz.

Value

Large value
("Arithmetic"
 ("Basic"
  ["-(1:)" calc-change-sign :keys "n" :active (>= (calc-stack-size) 1)]
  ["(2:) + (1:)" calc-plus :keys "+" :active (>= (calc-stack-size) 2)]
  ["(2:) - (1:)" calc-minus :keys "-" :active (>= (calc-stack-size) 2)]
  ["(2:) * (1:)" calc-times :keys "*" :active (>= (calc-stack-size) 2)]
  ["(2:) / (1:)" calc-divide :keys "/" :active
   (>= (calc-stack-size) 2)]
  ["(2:) ^ (1:)" calc-power :keys "^" :active (>= (calc-stack-size) 2)]
  ["(2:) ^ (1/(1:))"
   (progn
     (require 'calc-ext)
     (let ((calc-inverse-flag t)) (call-interactively 'calc-power)))
   :keys "I ^" :active (>= (calc-stack-size) 2) :help
   "The (1:)th root of (2:)"]
  ["abs(1:)"
   (progn (require 'calc-arith) (call-interactively 'calc-abs)) :keys
   "A" :active (>= (calc-stack-size) 1) :help "Absolute value"]
  ["1/(1:)"
   (progn (require 'calc-arith) (call-interactively 'calc-inv)) :keys
   "&" :active (>= (calc-stack-size) 1)]
  ["sqrt(1:)"
   (progn (require 'calc-math) (call-interactively 'calc-sqrt)) :keys
   "Q" :active (>= (calc-stack-size) 1)]
  ["idiv(2:,1:)"
   (progn (require 'calc-arith) (call-interactively 'calc-idiv)) :keys
   "\\" :active (>= (calc-stack-size) 2) :help
   "The integer quotient of (2:) over (1:)"]
  ["(2:) mod (1:)"
   (progn (require 'calc-misc) (call-interactively 'calc-mod)) :keys
   "%" :active (>= (calc-stack-size) 2) :help
   "The remainder when (2:) is divided by (1:)"])
 ("Rounding"
  ["floor(1:)"
   (progn (require 'calc-arith) (call-interactively 'calc-floor))
   :keys "F" :active (>= (calc-stack-size) 1) :help
   "The greatest integer less than or equal to (1:)"]
  ["ceiling(1:)"
   (progn (require 'calc-arith) (call-interactively 'calc-ceiling))
   :keys "I F" :active (>= (calc-stack-size) 1) :help
   "The smallest integer greater than or equal to (1:)"]
  ["round(1:)"
   (progn (require 'calc-arith) (call-interactively 'calc-round))
   :keys "R" :active (>= (calc-stack-size) 1) :help
   "The nearest integer to (1:)"]
  ["truncate(1:)"
   (progn (require 'calc-arith) (call-interactively 'calc-trunc))
   :keys "I R" :active (>= (calc-stack-size) 1) :help
   "The integer part of (1:)"])
 ("Complex Numbers"
  ["Re(1:)" (progn (require 'calc-cplx) (call-interactively 'calc-re))
   :keys "f r" :active (>= (calc-stack-size) 1)]
  ["Im(1:)" (progn (require 'calc-cplx) (call-interactively 'calc-im))
   :keys "f i" :active (>= (calc-stack-size) 1)]
  ["conj(1:)"
   (progn (require 'calc-cplx) (call-interactively 'calc-conj)) :keys
   "J" :active (>= (calc-stack-size) 1) :help
   "The complex conjugate of (1:)"]
  ["length(1:)"
   (progn (require 'calc-arith) (call-interactively 'calc-abs)) :keys
   "A" :active (>= (calc-stack-size) 1) :help
   "The length (absolute value) of (1:)"]
  ["arg(1:)"
   (progn (require 'calc-cplx) (call-interactively 'calc-argument))
   :keys "G" :active (>= (calc-stack-size) 1) :help
   "The argument (polar angle) of (1:)"])
 ("Conversion"
  ["Convert (1:) to a float"
   (progn (require 'calc-ext) (call-interactively 'calc-float)) :keys
   "c f" :active (>= (calc-stack-size) 1)]
  ["Convert (1:) to a fraction"
   (progn (require 'calc-ext) (call-interactively 'calc-fraction))
   :keys "c F" :active (>= (calc-stack-size) 1)])
 ("Binary"
  ["Set word size"
   (progn (require 'calc-bin) (call-interactively 'calc-word-size))
   :keys "b w"]
  ["Clip (1:) to word size"
   (progn (require 'calc-bin) (call-interactively 'calc-clip)) :keys
   "b c" :active (>= (calc-stack-size) 1) :help
   "Reduce (1:) modulo 2^wordsize"]
  ["(2:) and (1:)"
   (progn (require 'calc-bin) (call-interactively 'calc-and)) :keys
   "b a" :active (>= (calc-stack-size) 2) :help
   "Bitwise AND [modulo 2^wordsize]"]
  ["(2:) or (1:)"
   (progn (require 'calc-bin) (call-interactively 'calc-or)) :keys
   "b o" :active (>= (calc-stack-size) 2) :help
   "Bitwise inclusive OR [modulo 2^wordsize]"]
  ["(2:) xor (1:)"
   (progn (require 'calc-bin) (call-interactively 'calc-xor)) :keys
   "b x" :active (>= (calc-stack-size) 2) :help
   "Bitwise exclusive OR [modulo 2^wordsize]"]
  ["diff(2:,1:)"
   (progn (require 'calc-bin) (call-interactively 'calc-diff)) :keys
   "b d" :active (>= (calc-stack-size) 2) :help
   "Bitwise difference [modulo 2^wordsize]"]
  ["not (1:)"
   (progn (require 'calc-bin) (call-interactively 'calc-not)) :keys
   "b n" :active (>= (calc-stack-size) 1) :help
   "Bitwise NOT [modulo 2^wordsize]"]
  ["left shift(1:)"
   (progn
     (require 'calc-bin) (call-interactively 'calc-lshift-binary))
   :keys "b l" :active (>= (calc-stack-size) 1) :help
   "Shift (1:)[modulo 2^wordsize] one bit left"]
  ["right shift(1:)"
   (progn
     (require 'calc-bin) (call-interactively 'calc-rshift-binary))
   :keys "b r" :active (>= (calc-stack-size) 1) :help
   "Shift (1:)[modulo 2^wordsize] one bit right, putting 0s on the left"]
  ["arithmetic right shift(1:)"
   (progn (require 'calc-bin) (call-interactively 'calc-rshift-arith))
   :keys "b R" :active (>= (calc-stack-size) 1) :help
   "Shift (1:)[modulo 2^wordsize] one bit right, duplicating the leftmost bit"]
  ["rotate(1:)"
   (progn
     (require 'calc-bin) (call-interactively 'calc-rotate-binary))
   :keys "b t" :active (>= (calc-stack-size) 1) :help
   "Rotate (1:)[modulo 2^wordsize] one bit left"])
 "-------" ["Help on Arithmetic" (calc-info-goto-node "Arithmetic")])

Documentation

Menu for Calc's arithmetic functions.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-menu.el.gz
;;; calc-menu.el --- a menu for Calc  -*- lexical-binding:t -*-

;; Copyright (C) 2007-2025 Free Software Foundation, Inc.

;; This file is part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;;; Code:

(defvar calc-arithmetic-menu
  (list "Arithmetic"
        (list "Basic"
              ["-(1:)"         calc-change-sign
               :keys "n" :active (>= (calc-stack-size) 1)]
              ["(2:) + (1:)"   calc-plus
               :keys "+" :active (>= (calc-stack-size) 2)]
              ["(2:) - (1:)"   calc-minus
               :keys "-" :active (>= (calc-stack-size) 2)]
              ["(2:) * (1:)"   calc-times
               :keys "*" :active (>= (calc-stack-size) 2)]
              ["(2:) / (1:)"   calc-divide
               :keys "/" :active (>= (calc-stack-size) 2)]
              ["(2:) ^ (1:)"   calc-power
               :keys "^" :active (>= (calc-stack-size) 2)]
              ["(2:) ^ (1/(1:))"
               (progn
                 (require 'calc-ext)
                 (let ((calc-inverse-flag t))
                   (call-interactively 'calc-power)))
               :keys "I ^"
               :active (>= (calc-stack-size) 2)
               :help "The (1:)th root of (2:)"]
              ["abs(1:)"
               (progn
                 (require 'calc-arith)
                 (call-interactively 'calc-abs))
               :keys "A"
               :active (>= (calc-stack-size) 1)
               :help "Absolute value"]
              ["1/(1:)"
               (progn
                 (require 'calc-arith)
                 (call-interactively 'calc-inv))
               :keys "&"
               :active (>= (calc-stack-size) 1)]
              ["sqrt(1:)"
               (progn
                 (require 'calc-math)
                 (call-interactively 'calc-sqrt))
               :keys "Q"
               :active (>= (calc-stack-size) 1)]
              ["idiv(2:,1:)"
               (progn
                 (require 'calc-arith)
                 (call-interactively 'calc-idiv))
               :keys "\\"
               :active (>= (calc-stack-size) 2)
               :help "The integer quotient of (2:) over (1:)"]
              ["(2:) mod (1:)"
               (progn
                 (require 'calc-misc)
                 (call-interactively 'calc-mod))
               :keys "%"
               :active (>= (calc-stack-size) 2)
               :help "The remainder when (2:) is divided by (1:)"])
        (list "Rounding"
              ["floor(1:)"
               (progn
                 (require 'calc-arith)
                 (call-interactively 'calc-floor))
               :keys "F"
               :active (>= (calc-stack-size) 1)
               :help "The greatest integer less than or equal to (1:)"]
              ["ceiling(1:)"
               (progn
                 (require 'calc-arith)
                 (call-interactively 'calc-ceiling))
               :keys "I F"
               :active (>= (calc-stack-size) 1)
               :help "The smallest integer greater than or equal to (1:)"]
              ["round(1:)"
               (progn
                 (require 'calc-arith)
                 (call-interactively 'calc-round))
               :keys "R"
               :active (>= (calc-stack-size) 1)
               :help "The nearest integer to (1:)"]
              ["truncate(1:)"
               (progn
                 (require 'calc-arith)
                 (call-interactively 'calc-trunc))
               :keys "I R"
               :active (>= (calc-stack-size) 1)
               :help "The integer part of (1:)"])
        (list "Complex Numbers"
              ["Re(1:)"
               (progn
                 (require 'calc-cplx)
                 (call-interactively 'calc-re))
               :keys "f r"
               :active (>= (calc-stack-size) 1)]
              ["Im(1:)"
               (progn
                 (require 'calc-cplx)
                 (call-interactively 'calc-im))
               :keys "f i"
               :active (>= (calc-stack-size) 1)]
              ["conj(1:)"
               (progn
                 (require 'calc-cplx)
                 (call-interactively 'calc-conj))
               :keys "J"
               :active (>= (calc-stack-size) 1)
               :help "The complex conjugate of (1:)"]
              ["length(1:)"
               (progn (require 'calc-arith)
                      (call-interactively 'calc-abs))
               :keys "A"
               :active (>= (calc-stack-size) 1)
               :help "The length (absolute value) of (1:)"]
              ["arg(1:)"
               (progn
                 (require 'calc-cplx)
                 (call-interactively 'calc-argument))
               :keys "G"
               :active (>= (calc-stack-size) 1)
               :help "The argument (polar angle) of (1:)"])
        (list "Conversion"
              ["Convert (1:) to a float"
               (progn
                 (require 'calc-ext)
                 (call-interactively 'calc-float))
               :keys "c f"
               :active (>= (calc-stack-size) 1)]
              ["Convert (1:) to a fraction"
               (progn
                 (require 'calc-ext)
                 (call-interactively 'calc-fraction))
               :keys "c F"
               :active (>= (calc-stack-size) 1)])
        (list "Binary"
              ["Set word size"
               (progn
                 (require 'calc-bin)
                 (call-interactively 'calc-word-size))
               :keys "b w"]
              ["Clip (1:) to word size"
               (progn
                 (require 'calc-bin)
                 (call-interactively 'calc-clip))
               :keys "b c"
               :active (>= (calc-stack-size) 1)
               :help "Reduce (1:) modulo 2^wordsize"]
              ["(2:) and (1:)"
               (progn
                 (require 'calc-bin)
                 (call-interactively 'calc-and))
               :keys "b a"
               :active (>= (calc-stack-size) 2)
               :help "Bitwise AND [modulo 2^wordsize]"]
              ["(2:) or (1:)"
               (progn
                 (require 'calc-bin)
                 (call-interactively 'calc-or))
               :keys "b o"
               :active (>= (calc-stack-size) 2)
               :help "Bitwise inclusive OR [modulo 2^wordsize]"]
              ["(2:) xor (1:)"
               (progn
                 (require 'calc-bin)
                 (call-interactively 'calc-xor))
               :keys "b x"
               :active (>= (calc-stack-size) 2)
               :help "Bitwise exclusive OR [modulo 2^wordsize]"]
              ["diff(2:,1:)"
               (progn
                 (require 'calc-bin)
                 (call-interactively 'calc-diff))
               :keys "b d"
               :active (>= (calc-stack-size) 2)
               :help "Bitwise difference [modulo 2^wordsize]"]
              ["not (1:)"
               (progn
                 (require 'calc-bin)
                 (call-interactively 'calc-not))
               :keys "b n"
               :active (>= (calc-stack-size) 1)
               :help "Bitwise NOT [modulo 2^wordsize]"]
              ["left shift(1:)"
               (progn
                 (require 'calc-bin)
                 (call-interactively 'calc-lshift-binary))
               :keys "b l"
               :active (>= (calc-stack-size) 1)
               :help "Shift (1:)[modulo 2^wordsize] one bit left"]
              ["right shift(1:)"
               (progn
                 (require 'calc-bin)
                 (call-interactively 'calc-rshift-binary))
               :keys "b r"
               :active (>= (calc-stack-size) 1)
               :help "Shift (1:)[modulo 2^wordsize] one bit right, putting 0s on the left"]
              ["arithmetic right shift(1:)"
               (progn
                 (require 'calc-bin)
                 (call-interactively 'calc-rshift-arith))
               :keys "b R"
               :active (>= (calc-stack-size) 1)
               :help "Shift (1:)[modulo 2^wordsize] one bit right, duplicating the leftmost bit"]
              ["rotate(1:)"
               (progn
                 (require 'calc-bin)
                 (call-interactively 'calc-rotate-binary))
               :keys "b t"
               :active (>= (calc-stack-size) 1)
               :help "Rotate (1:)[modulo 2^wordsize] one bit left"])
        "-------"
        ["Help on Arithmetic"
         (calc-info-goto-node "Arithmetic")])
  "Menu for Calc's arithmetic functions.")