home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 083.lha / twm / XE.doc < prev    next >
Text File  |  1986-11-20  |  3KB  |  112 lines

  1. Documentation for XE - A mini-expression evaluator from Transactor Magazine
  2.  
  3. Code and docs freely distributable but
  4. copyright (c) 1987 Transactor Publishing Inc.
  5.  
  6. XE is an expression evaluator; a handy little calculator to have around for
  7. the odd bit of number-crunching you may need. It comes up in a window that
  8. can be sized, dragged, re-ordered and closed.
  9.  
  10. Features of XE:
  11.   * allows nested parentheses
  12.   * has 26 variables that can be used in expressions
  13.   * prints results in any number base
  14.   * accepts numerical constants in decimal, hex, binary or any other base
  15.   * can evaluate multiple expressions with a single command line
  16.   * assignments to variables can be made within expressions
  17.  
  18. Limitations:
  19.   * 32-bit integers only.
  20.   * no checking for overflow.
  21.   * the only operators supported are the four basic operations (+ - * /)
  22.       plus the modulo operation (%).
  23.  
  24. How to use XE:
  25.  
  26. XE doesn't work with a calculator keyboard, but allows you to enter
  27. expressions in their normal algebraic form, for example:
  28.  
  29.   >2*(3+4)-2*4      (The '>' is XE's prompt)
  30.   6                 (XE's answer)
  31.  
  32. Expressions are evaluated left-to-right, with multiplication, division
  33. and the modulo operation (*, / and %) taking precedence over addition and
  34. subtraction (+ and -).
  35.  
  36. XE allows single-letter variables, which can be assigned a constant or an
  37. expression, and used in expressions. For example:
  38.  
  39.   >a=5
  40.   5
  41.   >2*a
  42.   10
  43.   >b=a+1
  44.   6
  45.  
  46. Notice that a result is printed when a variable assignment is made. This is
  47. because an assignment returns a value in an expression (as in C). So you
  48. could do this:
  49.  
  50.   >25+3*(b=4*3)
  51.   61
  52.   >b
  53.   12
  54.  
  55. The variable 'b' was assigned the value 3*4, and that value was used in
  56. the expression. This allows you to do multiple-variable assignments:
  57.  
  58.   >a=b=c=d=e=x=0
  59.  
  60. XE will evaluate more than one expression at a time if you separate
  61. the expressions by commas. This can be useful to print out the values
  62. of several variables or results, e.g.:
  63.  
  64.   >a,b,c,a+b
  65.  
  66. XE can speak not only in decimal (base 10), but in any arbitrary base
  67. up to base 36. After you select a new base using the syntax Bn, XE
  68. will print all results in that base. For example, to work in hex:
  69.  
  70.   >B16
  71.   New base: 16 (decimal)
  72.   >23*10
  73.   $E6
  74.   >B24,21*10
  75.   New base: 21 (decimal)
  76.   21: AK
  77.  
  78. Notice that the notation for number bases higher than 16 extends hexadecimal
  79. notation by using letters of the alphabet higher than F. In this case, the
  80. 'A' in AK means '10 * 21^1', and the K means '20 * 21^0'.
  81.  
  82. To enter your numbers in a different base, use the following prefixes:
  83. $ - hexadecimal (base 16)
  84. % - binary (base 2)
  85. # - current output base
  86.  
  87. Example: add binary 100101110 to decimal 152 and print the result
  88. in hexadecimal. Solution:
  89.  
  90.   >B16
  91.   New base: 16 (decimal)
  92.   >%100101110+152
  93.   $1C6
  94.  
  95. When you're not actually calculating with XE, you can put it away temporarily
  96. without actually closing it down by selecting "Tiny Window" from the menu.
  97. The main XE window will close, and a conveniently small and inconspicuous
  98. window will open in its place. Clicking anywhere in the tiny window (except
  99. the drag bar or depth gadgets, of course) will close the tiny window and
  100. bring the main XE window up instead.
  101.  
  102. XE also supports Transactor's TWM (Tiny Window Manager) program, so if you
  103. have TWM running in your system when you select "Tiny Window" from the menu,
  104. XE will be allotted a gadget (named "TransCalc") in the TWM window, and will
  105. not bother to put up a tiny window of its own.
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.