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 >
Text File  |  1992-09-04  |  3KB  |  101 lines

  1. NAME
  2.     dc - desk calculator
  3.  
  4. SYNOPSIS
  5.     dc [ file ]
  6.  
  7. DESCRIPTION
  8.     dc is an arbitrary precision arithmetic package.  Ordinarily it
  9.     operates on decimal numbers, but you may specify an input base
  10.     or an output base.
  11.     The overall structure of dc is a stacking (reverse Polish)
  12.     calculator. If an argument is given input is taken from that
  13.     file, else standard input is used.
  14.  
  15.     The following constructions are recognized :
  16.  
  17.     number
  18.         The value of the number is pushed on the stack.  A
  19.         number is an unbroken string of the digits 0-9.  It
  20.         may be preceded by an underscore (_) to input a nega-
  21.         tive number.
  22.  
  23.     + - / * % ^ & |
  24.         The top two values on the stack are added (+), sub-
  25.         tracted (-), multiplied (*), divided (/), remaindered
  26.         (%), powered (^), anded (&), ored(|).  The two entries
  27.         are popped off the stack; the result is pushed on the
  28.         stack in their place.
  29.  
  30.     !    The top value on the stack is popped. If non-zero, 1 is
  31.         pushed back on the stack, else 0 is pushed.
  32.  
  33.     ~    The top value on the stack is popped, inverted, and the
  34.         result pushed back on the stack
  35.  
  36.     sr    The top of the stack is popped and stored into a
  37.         register named r, where r may be any character between
  38.         a and z.
  39.  
  40.     lr    The value in register r is pushed on the stack.  The
  41.         register r is not altered.  All registers start with
  42.         zero value.
  43.  
  44.     d    The top value on the stack is duplicated.
  45.  
  46.     p    The top value on the stack is printed.    The top value
  47.         remains unchanged.
  48.  
  49.     f    All values on the stack are printed.
  50.  
  51.     q    Exits the program.
  52.  
  53.     x    Treats the top element of the stack as a character
  54.         string and executes it as a string of dc commands.
  55.  
  56.     [ ... ] Puts the bracketed ASCII string onto the top of the
  57.         stack.
  58.  
  59.     c    All values on the stack are popped.
  60.  
  61.     i    The top value on the stack is popped and used as the
  62.         number radix for further input.
  63.  
  64.     I    Pushes the input base on the top of the stack.
  65.  
  66.     o    The top value on the stack is popped and used as the
  67.         number radix for further output.
  68.  
  69.     O    Pushes the output base on the top of the stack.
  70.  
  71.     k    The top value on the stack and used to set the number
  72.         of digit displayed after decimal  point.  By  default
  73.         precision is set to 0  :  dc  displays    only  integer
  74.         part.
  75.  
  76.     v    The top value on the stack is replaced by its  square
  77.         root
  78.  
  79.  
  80. RETURN CODES
  81.      0 if all went well
  82.      1 in case of bad argument (fatal)
  83.      2 if the named file couldn't be opened (fatal)
  84.      3 if no memory could be allocated (fatal)
  85.      6 if stack was empty (fatal)
  86.      7 if stack was full (fatal)
  87.     11 in case of missing bracket (fatal)
  88.     14 if you try to compute the square root of a negative number
  89.  
  90. CHANGES FROM UNIX
  91.     P, Q, X, <r, >r, =r, z, Z, and ? operators missing
  92.     Registers are not stacks nor strings
  93.     [expr] computed when popped
  94.     Cannot handle a full expression on the same line
  95.     Doesn't read standard input when EOF reached on named file
  96.  
  97. AUTHOR
  98.     Denis GOUNELLE
  99.     Last modified 04-Sep-92
  100.  
  101.