home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / news / 4569 / goodies8 / math / basecalc.doc < prev    next >
Text File  |  1993-02-18  |  5KB  |  100 lines

  1. (Comp.sys.handhelds)
  2. Item: 3219 by IMS103@psuvm.psu.edu [Ian Matthew Smith]
  3.   Subj: Infinite Base Calc V1.2
  4.   Date: Tue May 21 1991
  5.  
  6. ┌────────────────────────────────────────────────────────────────────┐
  7. │ Mini-instructions: Press BMTH; use special menu as detailed in box │
  8. │ below.  -jkh-                                                      │
  9. └────────────────────────────────────────────────────────────────────┘
  10.  
  11. This is version 1.2 of my Infinite Base [IB] calculator.  New in this
  12. version, it handles fractions.
  13.  
  14. [Note: "Infinite" is an exaggeration, of course; it handles bases up
  15.  to 62, and handles fraction expansion up to machine round-off, which
  16.  means approximately 40 bits.  Specifying bases larger than 62 or
  17.  decimal expansions past 40 bits will lead to erroneous results.  A
  18.  rule of thumb for the number of fractional digits to set is
  19.  IP(12/log(base)), so if you're using, say, base 36, you'd want
  20.  IP(12/log(36))= 7 digits after the decimal point, because after that
  21.  is where the round-off error becomes visible.  I took the liberty of
  22.  patching this into Ian's program, so now when you set the base, the
  23.  number of fraction digits is set automatically.  You can still set it
  24.  manually as before, too.  -jkh-]
  25.  
  26. IB numbers are in string form, e.g. "123" (base 8) = 83 (base 10).
  27.  
  28. This directory contains:
  29.  
  30. BMTH  : Sets up the following custom menu...
  31. ┌───────────────────────────────────────────────────────────────────────┐
  32. │ Add, etc : The standard 4 math functions that work on IB numbers.     │
  33. │ Base/Fix : This menu key shows 2 numbers separated by a slash. The    │
  34. │            first is the base you are working in, and the second is    │
  35. │            the number of desired fractional digits. Pressing it will  │
  36. │            store the number in level one as the current base [and     │
  37. │            automatically set the optimal number of fractional         │
  38. │            digits.  -jkh-]  Left-shifting will do the same, but also  │
  39. │            convert the level 2 IB number to the current base.         │
  40. │            Right-shifting sets the number of fractional digits to     │
  41. │            use in converting to IB numbers.                           │
  42. │ CONVERT  : Pressing this key will convert from an IB number to        │
  43. │            a base-10 number, and back.  Left-shifting will toggle     │
  44. │            between a binary number and a real.                        │
  45. └───────────────────────────────────────────────────────────────────────┘
  46.  
  47. ->IB  : Take either a binary or a real from the stack and return
  48.         it in the base specified in BBASE, rounded off to IBFIX
  49.         places.
  50.  
  51. IB->  : Take an IB string from the stack and convert it to either
  52.         a binary number or a real.  If IBFIX is set to zero, it will
  53.         always return a binary number.  If IBFIX is set to somthing
  54.         other than zero, it will use return a real if the base-10
  55.         numver is less than 1E12.
  56.  
  57. IB2-> : Runs IB-> on the objects in level one and two, leaving their
  58.         order intact.
  59.  
  60. BBASE : The current base. (2-62 is valid)
  61.  
  62. IBFIX : Number of desired decimal places. (0 will force all calculations
  63.                                            to be carried out in binaries)
  64.  
  65. ->IB2 : Runs ->IB on the objects in level 1 and two, leaving their
  66.         order intact.
  67.  
  68. [B->FIX: Calculates optimal IBFIX from BBASE.  -jkh-]
  69.  
  70. BSTR  : A string used in the conversion proccess.
  71.  
  72. Here's a few examples:
  73.  
  74.  (1) Set base 36 (and specify 7 fractional digits automatically):
  75.      36 [E]  -->  see [36/7] on E menu key.
  76.  (2) Now divide "153" (base 36) by 17 (base 10):
  77.      "153" 17 [DIV]  -->  "2F" (base 36).
  78.  (3) Convert that answer to base 10:
  79.      [CONV]  -->  87.
  80.  (4) What's "444" (base 44) divided by "222" (base 22), in base 22?
  81.      "444" 44 [E] 22 [orange-shift] [E] "222" [DIV]
  82.      -->  "7.HK5HK5HK".
  83.  
  84. Ok, lets see if I can make this understandable...  By using
  85. binary numbers for my conversions, the range of the calculations
  86. is greatly increased.  Unfortunately, you can't have fractions in
  87. binary numbers, so when you need to do fractional calculations,
  88. the IB programs will switch to decimal numbers when needed.
  89.  
  90. Setting the IBFIX variable to 0 will keep rounding errors from
  91. happening in the conversion.  If you set it to somthing else,
  92. be warned that you will lose precision if you do an operation
  93. on 2 numbers under 1E12 that result in an answer over 1E12.
  94.  
  95. Thanks to Paul Dujmich <pauld@fs1.ece.cmu.edu> for providing
  96. me with an easy way to convert the fractional part of a number
  97. to a different base, along with example code.
  98.  
  99.  - Ian Smith <<ims103@psuvm.psu.edu>>
  100.