This is an evolution of Ian Matthew Smith's Infinite Base Calculator
1.2 (I hope he doesn't mind I post this...) You can find the original
post in Joe K. Horn's Goodies #8 in the math subdirectory.

Basically It's a program that allows you to calculate in bases diferent
from ten. I found it useful in my computers architecture classes, but
it
lacked the representation of negative numbers. My additions are that
now
the calculator can represent the results in radix complement (RC),
diminished
complement (DC), sign and magnitude (I hope it's said like so in
english,
anyway SM) and using the original plain natural numbers notation (NONE)




**********************************************************************
* Mini-instructions: Press BMTH; use special menu as detailed in box *
* below.  -jkh-                                                      *
**********************************************************************

This is version 1.2 of my Infinite Base [IB] calculator.  New in this
version, it handles fractions.

[Note: "Infinite" is an exaggeration, of course; it handles bases up
 to 62, and handles fraction expansion up to machine round-off, which
 means approximately 40 bits.  Specifying bases larger than 62 or
 decimal expansions past 40 bits will lead to erroneous results.  A
 rule of thumb for the number of fractional digits to set is
 IP(12/log(base)), so if you're using, say, base 36, you'd want
 IP(12/log(36))= 7 digits after the decimal point, because after that
 is where the round-off error becomes visible.  I took the liberty of
 patching this into Ian's program, so now when you set the base, the
 number of fraction digits is set automatically.  You can still set it
 manually as before, too.  -jkh-]

IB numbers are in string form, e.g. "123" (base 8) = 83 (base 10).

This directory contains:

BMTH  : Sets up the following custom menu...

****************************************************************************
*
* Add, etc : The standard 4 math functions that work on IB numbers.    
*
* Base/Fix : This menu key shows 2 numbers separated by a slash. The   
*
*            first is the base you are working in, and the second is   
*
*            the number of desired fractional digits. Pressing it will 
*
*            store the number in level one as the current base [and    
*
*            automatically set the optimal number of fractional        
*
*            digits.  -jkh-]  Left-shifting will do the same, but also 
*
*            convert the level 2 IB number to the current base.        
*
*            Right-shifting sets the number of fractional digits to    
*
*            use in converting to IB numbers.                          
*

		 /\/\/\/\/\  THIS IS VERY IMPORTANT  /\/\/\/\/\


* CONVERT  : Pressing this key will convert from an IB number to       
*
*            a base-10 number, and back.  Left-shifting will toggle    
*
*            between a binary number and a real.                       
*
***************************************************************************

->IB  : Take either a binary or a real from the stack and return
	it in the base specified in BBASE, rounded off to IBFIX
	places.

IB->  : Take an IB string from the stack and convert it to either
	a binary number or a real.  If IBFIX is set to zero, it will
	always return a binary number.  If IBFIX is set to somthing
	other than zero, it will use return a real if the base-10
	numver is less than 1E12.

IB2-> : Runs IB-> on the objects in level one and two, leaving their
	order intact.

BBASE : The current base. (2-62 is valid)

IBFIX : Number of desired decimal places. (0 will force all
calculations
					   to be carried out in
binaries)

->IB2 : Runs ->IB on the objects in level 1 and two, leaving their
	order intact.

[B->FIX: Calculates optimal IBFIX from BBASE.  -jkh-]

BSTR  : A string used in the conversion proccess.

Here's a few examples:

 (1) Set base 36 (and specify 7 fractional digits automatically):
     36 [E]  -->  see [36/7] on E menu key.
 (2) Now divide "153" (base 36) by 17 (base 10):
     "153" 17 [DIV]  -->  "2F" (base 36).
 (3) Convert that answer to base 10:
     [CONV]  -->  87.
 (4) What's "444" (base 44) divided by "222" (base 22), in base 22?
     "444" 44 [E] 22 [orange-shift] [E] "222" [DIV]
     -->  "7.HK5HK5HK".

Ok, lets see if I can make this understandable...  By using
binary numbers for my conversions, the range of the calculations
is greatly increased.  Unfortunately, you can't have fractions in
binary numbers, so when you need to do fractional calculations,
the IB programs will switch to decimal numbers when needed.

Setting the IBFIX variable to 0 will keep rounding errors from
happening in the conversion.  If you set it to somthing else,
be warned that you will lose precision if you do an operation
on 2 numbers under 1E12 that result in an answer over 1E12.

Thanks to Paul Dujmich <pauld@fs1.ece.cmu.edu> for providing
me with an easy way to convert the fractional part of a number
to a different base, along with example code.

 - Ian Smith <<ims103@psuvm.psu.edu>>

   --------------------------- Now What's new -----------------------

 ->Xe : This returns the natural represented by the string number "xxx"
	No matter what representation we are using.

 NOTATION : The current representation system

 BOUNDS : The current representation bounds (A bigger or smaller number
	  from this limits would mean Overflow or Underflow) If we try
	  to represent a number too big or too small an "Out of bounds"
	  error will happen, but the program will try to turn an
	  (incorrect) answer.

 CALCBOUNDS : Calculates the above bounds in function of the radix
	      (base), the number of digits and the representation used.

 CHECKB : Checks that the result is in bounds.

 The BMATH menu has also been modifyed, now here is what you will find
 when you press BMATH

      [ADD] [RC] [2/8] [CONV] [->Xe] [BOUN]

ADD : It adds two string numbers "xxx" "yyy"

RC  : It tells you which representation you are using. Pressing the 'B'
      key, cycles the representation RM -> DC -> SM -> NONE ->RC -> ...

[base/digits] : The base / digits we are using. Change the base by
puting
		the new desired base in level one of the stack and
pressing
		the 'C' key. Change the Digit length puting the number
		of digits you want in the stack, pressing the i-> shift
		key and 'C'

CONV : Converts from decimal to string number and viceversa using the
       current representation system.

->Xe : Converts from string number to decimal as a natural (not using
       the representation system)

BOUNDS : Tells you the current bounds of representation


pressing the [next] menu you will see:

      [SUB] [MULT] [DIV] [   ] [   ] [   ]

      They work as they did in the previous version

About the fractions... Well, I haven't studied yet how FPU work and how
they represent internally their numbers, so I don't know if the
repesentation of non integer numbers are correct. Any helpful
indications
would be welcome. In NONE representation they work as fine as they did
in Ian's original program.


I'm NOT RESPONSABLE if you fail an exam because of this program
(neither is Ian) In my exams it worked well, but I didn't use decimals.

					Marc Moline


