@setfilename ../../info/calc
@c [title]
@settitle GNU Emacs Calc Manual
+@documentencoding UTF-8
@setchapternewpage odd
@comment %**end of header (This is for running Texinfo on a region.)
GNU Emacs @value{EMACSVER}.
@end ifnotinfo
-Copyright @copyright{} 1990--1991, 2001--2013 Free Software Foundation, Inc.
+Copyright @copyright{} 1990--1991, 2001--2014 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@c [begin]
@ifnottex
@node Top, Getting Started, (dir), (dir)
-@chapter The GNU Emacs Calculator
+@top The GNU Emacs Calculator
@noindent
@dfn{Calc} is an advanced desk calculator and mathematical tool
@kindex h n
The @kbd{h n} or @kbd{h C-n} (@code{calc-view-news}) command displays
-the ``news'' or change history of Calc. This is kept in the file
-@file{README}, which Calc looks for in the same directory as the Calc
-source files.
+the ``news'' or change history of Emacs, and jumps to the most recent
+portion concerning Calc (if present). For older history, see the file
+@file{etc/CALC-NEWS} in the Emacs distribution.
@kindex h C-c
@kindex h C-d
leaving the first, third, fourth, and so on; @kbd{M-3 M-@key{DEL}} deletes
the third stack element.
+The above commands do not depend on the location of the cursor.
+If the customizable variable @code{calc-context-sensitive-enter} is
+non-@code{nil} (@pxref{Customizing Calc}), these commands will become
+context sensitive. For example, instead of duplicating the top of the stack,
+@key{RET} will copy the element at the cursor to the top of the
+stack. With a positive numeric prefix, a copy of the element at the
+cursor and the appropriate number of preceding elements will be placed
+at the top of the stack. A negative prefix will still duplicate the
+specified element of the stack regardless of the cursor position.
+Similarly, @key{DEL} will remove the corresponding elements from the
+stack.
+
@kindex @key{TAB}
@pindex calc-roll-down
To exchange the top two elements of the stack, press @key{TAB}
a different table of operators. Hexadecimal numbers are entered and
displayed with a preceding dollar sign. (Thus the regular meaning of
@kbd{$2} during algebraic entry does not work in Pascal mode, though
-@kbd{$} (and @kbd{$$}, etc.) not followed by digits works the same as
+@kbd{$} (and @kbd{$$}, etc.)@: not followed by digits works the same as
always.) No special provisions are made for other non-decimal numbers,
vectors, and so on, since there is no universally accepted standard way
of handling these in Pascal.
$$ a_{i+1} = { a_i + b_i \over 2 } , \qquad b_{i+1} = \sqrt{a_i b_i} $$
@end tex
-@cindex Root-mean-square
-Another commonly used mean, the RMS (root-mean-square), can be computed
-for a vector of numbers simply by using the @kbd{A} command.
+@c @cindex Root-mean-square
+@c Another commonly used mean, the RMS (root-mean-square), can be computed
+@c for a vector of numbers simply by using the @kbd{A} command.
@kindex u S
@pindex calc-vector-sdev
If the units you request are inconsistent with the original units, the
number will be converted into your units times whatever ``remainder''
-units are left over. For example, converting @samp{55 mph} into acres
+units are left over. (This can be disabled; @pxref{Customizing Calc}.)
+For example, converting @samp{55 mph} into acres
produces @samp{6.08e-3 acre / m s}. (Recall that multiplication binds
more strongly than division in Calc formulas, so the units here are
acres per meter-second.) Remainder units are expressed in terms of
``fundamental'' units like @samp{m} and @samp{s}, regardless of the
input units.
-If you want to disallow using inconsistent units, you can set the customizable variable
-@code{calc-ensure-consistent-units} to @code{t} (@pxref{Customizing Calc}). In this case,
-if you request units which are inconsistent with the original units, you will be warned about
-it and no conversion will occur.
-
One special exception is that if you specify a single unit name, and
a compatible unit appears somewhere in the units expression, then
that compatible unit will be converted to the new unit and the
If the value on the stack does not contain any units, @kbd{u c} will
prompt first for the old units which this value should be considered
-to have, then for the new units. Assuming the old and new units you
-give are consistent with each other, the result also will not contain
-any units. For example, @kbd{@w{u c} cm @key{RET} in @key{RET}}
-converts the number 2 on the stack to 5.08.
+to have, then for the new units. (If the value on the stack can be
+simplified so that it doesn't contain any units, like @samp{ft/in} can
+be simplified to 12, then @kbd{u c} will still prompt for both old
+units and new units. Assuming the old and new units you give are
+consistent with each other, the result also will not contain any
+units. For example, @kbd{@w{u c} cm @key{RET} in @key{RET}} converts
+the number 2 on the stack to 5.08.
@kindex u b
@pindex calc-base-units
based on a fundamental physical process (although there are efforts to
change this) is the kilogram, which was originally defined as the mass
of one liter of water, but is now defined as the mass of the
-International Prototype Kilogram (IPK), a cylinder of platinum-iridium
-kept at the Bureau International des Poids et Mesures in S@`evres,
+international prototype of the kilogram (IPK), a cylinder of platinum-iridium
+kept at the Bureau international des poids et mesures in S@`evres,
France. (There are several copies of the IPK throughout the world.)
The British imperial units, once defined in terms of physical objects,
were redefined in 1963 in terms of SI units. The US customary units,
which is not a Lisp list.
Large integers are stored as lists of the form @samp{(bigpos @var{d0}
-@var{d1} @var{d2} @dots{})} for positive integers 1000000 or more, or
-@samp{(bigneg @var{d0} @var{d1} @var{d2} @dots{})} for negative integers
-@mathit{-1000000} or less. Each @var{d} is a base-1000 ``digit,'' a Lisp integer
-from 0 to 999. The least significant digit is @var{d0}; the last digit,
+@var{d1} @var{d2} @dots{})} for sufficiently large positive integers
+(where ``sufficiently large'' depends on the machine), or
+@samp{(bigneg @var{d0} @var{d1} @var{d2} @dots{})} for negative
+integers. Each @var{d} is a base-@expr{10^n} ``digit'' (where again,
+@expr{n} depends on the machine), a Lisp integer from 0 to
+99@dots{}9. The least significant digit is @var{d0}; the last digit,
@var{dn}, which is always nonzero, is the most significant digit. For
-example, the integer @mathit{-12345678} is stored as @samp{(bigneg 678 345 12)}.
+example, the integer @mathit{-12345678} might be stored as
+@samp{(bigneg 678 345 12)}.
The distinction between small and large integers is entirely hidden from
the user. In @code{defmath} definitions, the Lisp predicate @code{integerp}
is @code{nil}.
@end defvar
+@defvar calc-context-sensitive-enter
+The commands @code{calc-enter} and @code{calc-pop} will typically
+duplicate the top of the stack. If
+@code{calc-context-sensitive-enter} is non-@code{nil}, then the
+@code{calc-enter} will copy the element at the cursor to the
+top of the stack and @code{calc-pop} will delete the element at the
+cursor. The default value of @code{calc-context-sensitive-enter} is
+@code{nil}.
+@end defvar
+
@defvar calc-undo-length
The variable @code{calc-undo-length} determines the number of undo
steps that Calc will keep track of when @code{calc-quit} is called.