(Comp.sys.handhelds) Item: 3219 by IMS103@psuvm.psu.edu [Ian Matthew Smith] Subj: Infinite Base Calc V1.2 Date: Tue May 21 1991 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ 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. ³ ³ 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 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 <>