Ian Matthew Smith <IMS103@psuvm.psu.edu> (05/18/91)
This is a new release of my previous program.
Infinate Base Calculator Version 1.1
Version 1.0 has a problem with numbers over a trillion.
Changes: The conversion routines now use binary numbers, so
the effective range is increased from 999999999999
to 18446744073709551615. HbXm5a3 and LygHa16AHYF
in base-62. :-)
Small change in how the [E] key in the custom menu.
You can now easily convert between diffrent bases.
Left-shift CONV in the custom menu will toggle
the object in level one betwen a real number and a
binary number
Example: Multiply the base-13 number 123A and the base-7 number 654.
13 [E] <-- Set the base to 13.
"123A" [ENTER]
7 [left-shift E] <-- Convert the base-13 number to base-7
and make base-7 the current base.
"654" MUL
You get the answer 10212444 in base-7. CONV converts it into
a binary number, and Left-shift CONV will toggle the binary number
into a real, giving you 860472. (In base-10 of course)
Quiz: What is #65479187251277d in base-62?
This directory contains the following:
BMTH : This creates a custom menu to help with doing math in IB
format. Add, Sub, Mul, and Div are just replacements for
the keys on the HP. CONV will convert an integer or binary
bumber to an IB string and back automaticly. The 5th softkey
[E] shows the base you are working in. Pressing it will take
the number in level one and make it the current base. Left-
shifting [E] works like the unshifted [E], but also converts
the number in level two to the new base. Change the "Add" to
"+", "Sub" to "-", ect.. if you think it looks better)
->IB : Convert an integer or binary number into an IB string.
IB-> : Convert an IB string into a binary number.
->IB2 : Take the first two items and run ->IB on them,
leaving their order intact.
IB2-> : Take the first two items and run IB-> on them,
leaving their order intact.
BBASE : The current base.
BSTR : A string used in the conversion proccess.
-- Ian Smith <<ims103@psuvm.psu.edu>>
Directory BASE
Cksum - #714Dh
Bytes - 1029.5
------------ Cut here ---------------
%%HP: T(3)A(R)F(.);
DIR
BMTH
\<< { Add
\<< IB2\-> + \->IB
\>> } { Sub
\<< IB2\-> - \->IB
\>> } { Mul
\<< IB2\-> * \->IB
\>> } { Div
\<< IB2\-> / \->IB
\>> } "B="
BBASE + {
\<< 'BBASE' STO
BMTH
\>>
\<< SWAP IB\->
SWAP 'BBASE' STO
\->IB BMTH
\>> } 2 \->LIST {
CONV {
\<< DUP
IF TYPE 0
==
THEN R\->B
END DUP
IF TYPE 10
==
THEN \->IB
ELSE IB\->
END
\>>
\<< DUP
IF TYPE 0
==
THEN R\->B
ELSE DUP
IF TYPE
10 ==
THEN B\->R
END
END
\>> } } 6 \->LIST
TMENU
\>>
\->IB
\<< DUP
IF TYPE 0 ==
THEN R\->B
END DUP
IF TYPE 10 ==
THEN RCWS
SWAP "" SWAP 64
STWS
WHILE DUP
B\->R
REPEAT DUP
BBASE DUP2 / * - 1
+ BSTR SWAP B\->R DUP
SUB ROT + SWAP
BBASE /
END DROP
SWAP STWS
END
\>>
IB\->
\<< DUP
IF TYPE 2 ==
THEN RCWS
SWAP 64 STWS # 0h
SWAP DUP SIZE 1 - 0
SWAP
FOR j DUP
DUP SIZE j - DUP
SUB BSTR SWAP POS 1
- # 1h
IF j 0 >
THEN
BBASE 1 j
START
DUP ROT * SWAP
NEXT
DROP
END * ROT
+ SWAP
NEXT DROP
SWAP STWS
END
\>>
\->IB2
\<< \->IB SWAP \->IB
SWAP
\>>
IB2\->
\<< IB\-> SWAP IB\->
SWAP
\>>
BBASE 62
BSTR
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
END