This file documents Calc, the GNU Emacs calculator.
@end ifinfo
@ifnotinfo
-This file documents Calc, the GNU Emacs calculator, included with GNU Emacs 23.1.
+This file documents Calc, the GNU Emacs calculator, included with GNU Emacs 23.3.
@end ifnotinfo
Copyright @copyright{} 1990, 1991, 2001, 2002, 2003, 2004,
-2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@end quotation
@end copying
-@dircategory Emacs
+@dircategory Emacs misc features
@direntry
-* Calc: (calc). Advanced desk calculator and mathematical tool.
+* Calc: (calc). Advanced desk calculator and mathematical tool.
@end direntry
@titlepage
@cindex Saving mode settings
@cindex Permanent mode settings
@cindex Calc init file, mode settings
-You can save all of the current mode settings in your Calc init file
+You can save all of the current mode settings in your Calc init file
(the file given by the variable @code{calc-settings-file}, typically
-@file{~/.calc.el}) with the @kbd{m m} (@code{calc-save-modes}) command.
-This will cause Emacs to reestablish these modes each time it starts up.
-The modes saved in the file include everything controlled by the @kbd{m}
-and @kbd{d} prefix keys, the current precision and binary word size,
-whether or not the trail is displayed, the current height of the Calc
-window, and more. The current interface (used when you type @kbd{C-x * *})
-is also saved. If there were already saved mode settings in the
-file, they are replaced. Otherwise, the new mode information is
-appended to the end of the file.
+@file{~/.emacs.d/calc.el}) with the @kbd{m m} (@code{calc-save-modes})
+command. This will cause Emacs to reestablish these modes each time
+it starts up. The modes saved in the file include everything
+controlled by the @kbd{m} and @kbd{d} prefix keys, the current
+precision and binary word size, whether or not the trail is displayed,
+the current height of the Calc window, and more. The current
+interface (used when you type @kbd{C-x * *}) is also saved. If there
+were already saved mode settings in the file, they are replaced.
+Otherwise, the new mode information is appended to the end of the
+file.
@kindex m R
@pindex calc-mode-record-mode
in the current radix. (Larger integers will still be displayed in their
entirety.)
+@cindex Two's complements
+With the binary, octal and hexadecimal display modes, Calc can
+display @expr{w}-bit integers using two's complement notation. This
+option is selected with the key sequences @kbd{C-u d 2}, @kbd{C-u d 8}
+and @kbd{C-u d 6}, respectively, and a negative word size might be
+appropriate (@pxref{Binary Functions}). In two's complement
+notation, the integers in the (nearly) symmetric interval from
+@texline @math{-2^{w-1}}
+@infoline @expr{-2^(w-1)}
+to
+@texline @math{2^{w-1}-1}
+@infoline @expr{2^(w-1)-1}
+are represented by the integers from @expr{0} to @expr{2^w-1}:
+the integers from @expr{0} to
+@texline @math{2^{w-1}-1}
+@infoline @expr{2^(w-1)-1}
+are represented by themselves and the integers from
+@texline @math{-2^{w-1}}
+@infoline @expr{-2^(w-1)}
+to @expr{-1} are represented by the integers from
+@texline @math{2^{w-1}}
+@infoline @expr{2^(w-1)}
+to @expr{2^w-1} (the integer @expr{k} is represented by @expr{k+2^w}).
+Calc will display a two's complement integer by the radix (either
+@expr{2}, @expr{8} or @expr{16}), two @kbd{#} symbols, and then its
+representation (including any leading zeros necessary to include all
+@expr{w} bits). In a two's complement display mode, numbers that
+are not displayed in two's complement notation (i.e., that aren't
+integers from
+@texline @math{-2^{w-1}}
+@infoline @expr{-2^(w-1)}
+to
+@c (
+@texline @math{2^{w-1}-1})
+@infoline @expr{2^(w-1)-1})
+will be represented using Calc's usual notation (in the appropriate
+radix).
+
@node Grouping Digits, Float Formats, Radix Modes, Display Modes
@subsection Grouping Digits
particular, negative arguments are converted to positive integers modulo
@expr{2^w} by all binary functions.
-If the word size is negative, binary operations produce 2's complement
+If the word size is negative, binary operations produce twos-complement
integers from
@texline @math{-2^{-w-1}}
@infoline @expr{-(2^(-w-1))}
@smallexample
(let ((calc-command-flags nil))
(unwind-protect
- (save-excursion
+ (save-current-buffer
(calc-select-buffer)
@emph{body of function}
@emph{renumber stack}
so any efforts can be coordinated.
The latest version of Calc is available from Savannah, in the Emacs
-CVS tree. See @uref{http://savannah.gnu.org/projects/emacs}.
+repository. See @uref{http://savannah.gnu.org/projects/emacs}.
@c [summary]
@node Summary, Key Index, Reporting Bugs, Top