This is Info file dc.info, produced by Makeinfo version 1.68 from the input file dc.texi. This file documents DC, an arbitrary precision calculator. Published by the Free Software Foundation, 675 Massachusetts Avenue, Cambridge, MA 02139 USA Copyright (C) 1984, 1994, 1997, 1998 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation.  File: dc.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) * Menu: * Introduction:: Introduction * Invocation:: Invocation * Printing Commands:: Printing Commands * Arithmetic:: Arithmetic * Stack Control:: Stack Control * Registers:: Registers * Parameters:: Parameters * Strings:: Strings * Status Inquiry:: Status Inquiry * Miscellaneous:: Other commands * Reporting bugs:: Reporting bugs  File: dc.info, Node: Introduction, Next: Invocation, Prev: Top, Up: Top Introduction ************ DC is a reverse-polish desk calculator which supports unlimited precision arithmetic. It also allows you to define and call macros. Normally DC reads from the standard input; if any command arguments are given to it, they are filenames, and DC reads and executes the contents of the files instead of reading from standard input. All normal output is to standard output; all error messages are written to standard error. To exit, use `q'. `C-c' does not exit; it is used to abort macros that are looping, etc. (Currently this is not true; `C-c' does exit.) A reverse-polish calculator stores numbers on a stack. Entering a number pushes it on the stack. Arithmetic operations pop arguments off the stack and push the results. To enter a number in DC, type the digits, with an optional decimal point. Exponential notation is not supported. To enter a negative number, begin the number with `_'. `-' cannot be used for this, as it is a binary operator for subtraction instead. To enter two numbers in succession, separate them with spaces or newlines. These have no meaning as commands.  File: dc.info, Node: Invocation, Next: Printing Commands, Prev: Introduction, Up: Top Invocation ********** DC may be invoked with the following command-line options: `-e EXPR' `--expression=EXPR' Evaluate EXPR as DC commands. `-f FILE' `--file=FILE' Read and evaluate DC commands from FILE. `-h' `--help' Print a usage message summarizing the command-line options, then exit. `-V' `--version' Print the version information for this program, then exit. If any command-line parameters remain after processing the options, these parameters are interpreted as additional FILEs whose contents are read and evaluated. A file name of `-' refers to the standard input stream. If no `-e' option was specified, and no files were specified, then the standard input will be read for commands to evaluate.  File: dc.info, Node: Printing Commands, Next: Arithmetic, Prev: Invocation, Up: Top Printing Commands ***************** `p' Prints the value on the top of the stack, without altering the stack. A newline is printed after the value. `n' Prints the value on the top of the stack, popping it off, and does not print a newline after. (This command is a GNU extension.) `P' Pops off the value on top of the stack. If it it a string, it is simply printed without a trailing newline. Otherwise it is a number, and the integer portion of its absolute value is printed out as a "base (UCHAR_MAX+1)" byte stream. Assuming that (UCHAR_MAX+1) is 256 (as it is on most machines with 8-bit bytes), the sequence `KSK 0k1/ [_1*]sx d0>x [256~aPd0R' Pops two values off the stack and compares them assuming they are numbers, executing the contents of register R as a macro if the original top-of-stack is greater. Thus, `1 2>a' will invoke register `a''s contents and `2 1>a' will not. `!>R' Similar but invokes the macro if the original top-of-stack is not greater (is less than or equal to) what was the second-to-top. ` commands take precidence, so if you want to run a command starting with <, =, or > you will need to add a space after the !. `#' Will interpret the rest of the line as a comment. (This command is a GNU extension.) `:R' Will pop the top two values off of the stack. The old second-to-top value will be stored in the array R, indexed by the old top-of-stack value. `;R' Pops the top-of-stack and uses it as an index into the array R. The selected value is then pushed onto the stack. Note that each stacked instance of a register has its own array associated with it. Thus `1 0:A 0SA 2 0:A LA 0;Ap' will print 1, because the 2 was stored in an instance of 0:A that was later popped.  File: dc.info, Node: Reporting bugs, Prev: Miscellaneous, Up: Top Reporting bugs ************** Email bug reports to `bug-gnu-utils@prep.ai.mit.edu'. Be sure to include the word "dc" somewhere in the "Subject:" field.  Tag Table: Node: Top983 Node: Introduction1562 Node: Invocation2779 Node: Printing Commands3623 Node: Arithmetic4801 Node: Stack Control7714 Node: Registers8127 Node: Parameters9053 Node: Strings10314 Node: Status Inquiry13284 Node: Miscellaneous13841 Node: Reporting bugs14808  End Tag Table