home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / calculat / pibcal11.zip / PIBCALC.HLP < prev    next >
Text File  |  1985-03-11  |  9KB  |  266 lines

  1. *** PIBCALC -- Interactive Desk Calculator.
  2. *   Version:   1.1
  3. *   Date:      March, 1985
  4. *   Author:    Philip R. Burns
  5. *
  6.  
  7. *** Invoking PIBCALC:
  8. *
  9. *   Type:
  10. *
  11. *      PIBCALC
  12. *
  13. *   in response to the MS-DOS prompt.
  14.  
  15. *** Leaving PIBCALC:
  16. *
  17. *   Type:
  18. *
  19. *      EXIT
  20. *
  21. *   in response to the PibCalc prompt.
  22.  
  23. *** INTRODUCTION.
  24. *
  25. *   PIBCALC is an interactive desk calculator designed especially for
  26. *   Programmers.  PIBCALC tries to combine the features of the better
  27. *   pocket calculators with the well-known expression syntax of the
  28. *   common algorithmic programming languages.  PIBCALC offers the
  29. *   following features:
  30. *
  31. *      Integer and Real Floating Point Arithmentic
  32. *      Octal, Decimal, and Hexadecimal Bases.
  33. *      The usual arithmetic operators.
  34. *      Common mathematical functions.
  35. *      User-defined variables.
  36. *      User-defined functions.
  37.  
  38.  
  39. *** COMMANDS.
  40. *
  41. *   EXP         Display value of expression.
  42. *   VAR=EXP     Set variable to value of expression and display result.
  43. *   END or EXIT Quit PIBCALC.
  44. *   HELP        Display this documentation.
  45. *   DEC         Set default base to decimal (default).
  46. *   OCT         Set default base to octal.
  47. *   HEX         Set default base to hexadecimal.
  48. *   RAD         Use radians for trigonometric functions (default).
  49. *   DEG         Use degrees for trigonometric functions.
  50. *   FRAC=INT    Set number of digits to display after the decimal
  51. *               point (default = 2).
  52. *   DEF FNAME(V1,...,VN) = EXP   Define a user function.
  53. *   DEL FNAME   Delete a user function definition.
  54. *   DEL V       Delete a variable definition.
  55. *   SHOW FUNCS  Display all user-defined functions.
  56. *   SHOW VARS   Display all defined variables.
  57. *   EDIT        Edit last command entered and execute edited version.
  58. *   Just <CR>   Display current value of accumulator.
  59.  
  60.  
  61. *** TYPES.
  62. *
  63. *   PIBCALC understands two types of numbers:  Integers and Reals.
  64. *   Most operators and functions allow either integer or real
  65. *   arguments.  Some require integer arguments.  Integers are
  66. *   automatically converted to reals when necessary.
  67. *
  68. *   Note that at this time, Turbo Pascal 2.0 only supports 16-bit
  69. *   integers.  Operations resulting in integer values outside the
  70. *   16-bit range will produce bizarre results from PibCalc.
  71.  
  72. *** DISPLAYS.
  73. *
  74. *   Numbers are displayed according to their type.  Integers are
  75. *   displayed in all three bases:  decimal, octal, and hex.  Reals
  76. *   are displayed in both regular and scientific (exponential) format.
  77.  
  78.  
  79. *** CONSTANTS.
  80. *
  81. *   Integer constants may be followed by an 'O' or 'B' (for Octal),
  82. *   'X' (for hexadecimal), or 'D' (for decimal), to override the
  83. *   default base.  Real constants MUST contain a decimal point, and may
  84. *   the usual 'E' notation for exponents.  Real constants are
  85. *   always decimal.
  86. *
  87. *   EXAMPLES:
  88. *
  89. *   3126             (Default base used)
  90. *   734B             (Octal)
  91. *   A16B4X           (Hex)
  92. *   73.6             (Real)
  93. *   19.              (Real)
  94. *   .541E-4          (Real with exponent)
  95.  
  96.  
  97. *** VARIABLES.
  98. *
  99. *   Any of the 26 letters 'A' through 'Z' may be used as a variable.
  100. *   Initially all 26 are undefined.  Lower case letters are treated
  101. *   as upper case letters.
  102.  
  103.  
  104. *** THE ACCUMULATOR.
  105. *
  106. *   PIBCALC keeps track of the last value calculated for an expression
  107. *   in an 'accumulator'.  The syntactic element '.' can be used to allow
  108. *   expressions to refer to this value.
  109.  
  110.  
  111. *** OPERATORS.
  112. *
  113. *   +         Addition.
  114. *   -         Subtraction.
  115. *   *         Multiplication.
  116. *   /         Real division.
  117. *   **        Exponentiation.
  118. *   DIV       Integer division.
  119. *   MOD       Integer MOD function.
  120. *
  121. *   + - *:    Result is an integer IFF both arguments are integers.
  122. *   /:        Result is always real.
  123. *   MOD, DIV: Result is always an integer.  Both operands must be
  124. *             integers.
  125. *   **: X**Y  is an integer IFF X is an integer and Y is an integer
  126. *             and Y >= 0.  Otherwise the result is real.
  127. *
  128. *   PRECEDENCE LEVELS (1 highest, 3 lowest):
  129. *
  130. *     1.    **
  131. *     2.    * / MOD DIV
  132. *     3.    + -
  133. *
  134. *   Within a precedence level evaluation is always left-to-right.
  135.  
  136.  
  137. *** STANDARD MATH FUNCTIONS AND CONSTANTS.
  138. *
  139. *   ABS(X)      SIN(X)    ASIN(X)    EXP(X)     EE
  140. *   MIN(X,...)  COS(X)    ACOS(X)    LN(X)      PI
  141. *   MAX(X,...)  TAN(X)    ATAN(X)    LOG10(X)
  142. *   TRUNC(X)    COT(X)    ACOT(X)    LOG(B,X)
  143. *   ROUND(X)    SEC(X)    ASEC(X)    SQRT(X)
  144. *               CSC(X)    ACSC(X)
  145. *                         ATAN2(Y,X)
  146. *
  147. *   ABS, MIN, MAX: Result is an integer IFF all arguments are integers.
  148. *   TRUNC, ROUND:  Result is always an integer.
  149. *   All others:    Result is always real.
  150. *
  151. *   ASIN, ATAN, ACSC: Function result Z is in range ABS(Z) <= PI/2.
  152. *   ACOS, ACOT, ASEC: Function result Z is in range 0 <= Z <= PI.
  153. *   ATAN2:            Function result Z is in range ABS(Z) <= PI.
  154. *
  155. *   ATAN2(Y,X) returns the inverse tangent of Y/X.
  156. *
  157. *   EE is the mathematical constant 2.71828... , the base of the natural
  158. *   (Naperian) logarithms.  The name has two Es to avoid confusion with
  159. *   the variable named E.
  160.  
  161.  
  162. *** USER-DEFINED FUNCTIONS.
  163. *
  164. *   You may define up to twenty functions.  For example, the following
  165. *   functions of three variables compute the two roots of the
  166. *   quadratic equation  A*X**2 + B*X + C = 0 (if it has any real roots):
  167. *
  168. *   DEF ROOT1(A,B,C) = (-B + SQRT(B*B - 4*A*C)) / (2*A)
  169. *   DEF ROOT2(A,B,C) = (-B - SQRT(B*B - 4*A*C)) / (2*A)
  170. *
  171. *   The following calls to these functions display the roots of
  172. *   X**2 - 5*X + 6 = 0:
  173. *
  174. *   ROOT1(1,-5,6)
  175. *   ROOT2(1,-5,6)
  176. *
  177. *   There are no restrictions on the expression used to define the
  178. *   function.  Any variables which appear in the expression which do not
  179. *   appear in the formal parameter list refer to the global variables
  180. *   'A' through 'Z'.  User-defined functions may call each other.
  181. *   They are evaluated interpretively.  For example, if function AA
  182. *   calls function BB, and then BB is redefined, then later calls
  183. *   to AA will use the NEW definition of BB.  However, user functions
  184. *   should not call each other recursively, since an infinite loop
  185. *   might result.
  186. *
  187. *   User-defined functions may have 0 to 10 formal parameters.
  188. *
  189. *   Function names may be 1 to 9 characters long.  They MUST start
  190. *   with a letter, and contain only the letters and digits.  Uppercase
  191. *   and lowercase are not distinguished in function names.
  192. *
  193. *   If a function is defined with the same name as a standard PIBCALC
  194. *   function or variable name then the user function definition
  195. *   overrides the built-in definition.
  196.  
  197.  
  198. *** EXPRESSIONS.
  199. *
  200. *   Expressions are composed of constants, variables, function calls,
  201. *   and the special element '.', using the operators  +, -, *, /, **,
  202. *   MOD, and DIV, acoording to the usual algorithmic programming language
  203. *   syntax rules.  Parentheses may be used for grouping.  The precise
  204. *   syntax is given below in a modified Backus-Naur form.
  205. *
  206. *   NOTATION USED:
  207. *
  208. *   =            is defined to be.
  209. *   .            end of definition.
  210. *   '...'        Literal.
  211. *   [...]        Optional.
  212. *   <...>        Repeat 0 or more times.
  213. *   |            Or.
  214. *   (...)        Grouping.
  215. *
  216. *   EXP     = [SIGN] TERM < ADOP TERM >.
  217. *   TERM    = FACTOR < MULOP FACTOR >.
  218. *   FACTOR  = ELEMENT < '**' ELEMENT >.
  219. *   ELEMENT = CONST | VAR | '(' EXP ')' | '.' | FUNC.
  220. *   SIGN    = '+' | '-'.
  221. *   ADOP    = '+' | '-'.
  222. *   MULOP   = '*' | '/' | 'MOD' | 'DIV'.
  223. *   CONST   = INT | REAL.
  224. *   INT     = DECINT | OCTINT | HEXINT.
  225. *   DECINT  = DEC <DEC> ['D'].
  226. *   OCTINT  = OCT <OCT> ['B'|'O'].
  227. *   HEXINT  = HEX <HEX> ['X'].
  228. *   REAL    = DEC <DEC> '.' <DEC> [EXPON] |
  229. *             <DEC> '.' DEC <DEC> [EXPON].
  230. *   EXPON   = 'E' [SIGN] DEC <DEC>.
  231. *   VAR     = LET.
  232. *   FUNC    = FNAME [ '(' EXP < ',' EXP > ')' ].
  233. *   FNAME   = LET < ALPHNUM >.
  234. *   ALPHNUM = LET | DEC.
  235. *   LET     = 'A' | ... | 'Z'.
  236. *   DEC     = '0' | ... | '9'.
  237. *   OCT     = '0' | ... | '7'.
  238. *   HEX     = '0' | ... | '9' | 'A' | ... | 'F'.
  239.  
  240.  
  241. *** NOTES ON HEX MODE.
  242. *
  243. *   When the default base is hexadecimal many ambiguities can arise.
  244. *   For example, the letters 'A' through 'F' could be either variable
  245. *   names or hex constants. 'DEC' could be either a command or a
  246. *   hex constant, and '32B' could be either the octal constant (= 26 dec.)
  247. *   or the hex constant 32B.  The rule is that ALL SUCH AMBIGUITIES
  248. *   ARE RESOLVED IN FAVOR OF THE INTERPRETATION AS A HEX CONSTANT.
  249. *   To override this rule a colon (:) may be used to prefix the construct.
  250. *   For example, ':32B' always means the octal constant 32 (=26 dec.),
  251. *   whatever the default base may be.
  252.  
  253. *** NOTES ON EDIT MODE.
  254. *
  255. *   When the command EDIT is entered, the last command line is re-displayed.
  256. *   This line may then be edited using WordStar commands or the keypad
  257. *   keys, quite similarly to the way the Turbo editor works.  A carriage
  258. *   return ends the editing and causes PibCalc to scan and execute the
  259. *   edited line.  This facility is particularly useful when defining
  260. *   several similar functions, or to repair syntactic errors like
  261. *   missing or extra parentheses in function definitions.
  262. *
  263. *   Note:  The INS key toggles overwrite and insert mode.
  264. *
  265.  
  266.