home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d7xx
/
d747
/
aush.lha
/
AUSH
/
ExtraCmds.lha
/
englishdocs
/
dc.doc
< prev
next >
Wrap
Text File
|
1992-09-04
|
3KB
|
101 lines
NAME
dc - desk calculator
SYNOPSIS
dc [ file ]
DESCRIPTION
dc is an arbitrary precision arithmetic package. Ordinarily it
operates on decimal numbers, but you may specify an input base
or an output base.
The overall structure of dc is a stacking (reverse Polish)
calculator. If an argument is given input is taken from that
file, else standard input is used.
The following constructions are recognized :
number
The value of the number is pushed on the stack. A
number is an unbroken string of the digits 0-9. It
may be preceded by an underscore (_) to input a nega-
tive number.
+ - / * % ^ & |
The top two values on the stack are added (+), sub-
tracted (-), multiplied (*), divided (/), remaindered
(%), powered (^), anded (&), ored(|). The two entries
are popped off the stack; the result is pushed on the
stack in their place.
! The top value on the stack is popped. If non-zero, 1 is
pushed back on the stack, else 0 is pushed.
~ The top value on the stack is popped, inverted, and the
result pushed back on the stack
sr The top of the stack is popped and stored into a
register named r, where r may be any character between
a and z.
lr The value in register r is pushed on the stack. The
register r is not altered. All registers start with
zero value.
d The top value on the stack is duplicated.
p The top value on the stack is printed. The top value
remains unchanged.
f All values on the stack are printed.
q Exits the program.
x Treats the top element of the stack as a character
string and executes it as a string of dc commands.
[ ... ] Puts the bracketed ASCII string onto the top of the
stack.
c All values on the stack are popped.
i The top value on the stack is popped and used as the
number radix for further input.
I Pushes the input base on the top of the stack.
o The top value on the stack is popped and used as the
number radix for further output.
O Pushes the output base on the top of the stack.
k The top value on the stack and used to set the number
of digit displayed after decimal point. By default
precision is set to 0 : dc displays only integer
part.
v The top value on the stack is replaced by its square
root
RETURN CODES
0 if all went well
1 in case of bad argument (fatal)
2 if the named file couldn't be opened (fatal)
3 if no memory could be allocated (fatal)
6 if stack was empty (fatal)
7 if stack was full (fatal)
11 in case of missing bracket (fatal)
14 if you try to compute the square root of a negative number
CHANGES FROM UNIX
P, Q, X, <r, >r, =r, z, Z, and ? operators missing
Registers are not stacks nor strings
[expr] computed when popped
Cannot handle a full expression on the same line
Doesn't read standard input when EOF reached on named file
AUTHOR
Denis GOUNELLE
Last modified 04-Sep-92