IMS103@psuvm.psu.edu (Ian Matthew Smith) (05/16/91)
Have you ever needed to do work in an odd base, like 4 or 12? If so, these programs will do them for you. Infinate base (IB) numbers are stored as strings. Example... Example: Add the base 13 numbers, 123A and 456B. BMTH 13 [LEFT-SHIFT E] <-- That sets the current base to 13. "123A" [ENTER] "456B" ADD You get "57A8". Pressing CONV will give you the base 10 represantation. (12306) Hope these instructions are not TOO horrible.... 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 to an IB string and back automaticly. The 5th softkey (E) shows the base you are working in. Pressing it will put the current base in level one, and right-shifting it will store the number in level one as the current base. (Change the "Add" to "+", "Sub" to "-", ect.. if you think it looks better) ->IB : Convert an integer into an IB string. IB-> : Convert an IB string into an integer. ->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 - #F164h Bytes - 715.5 ------------ Cut here --------------- %%HP: T(3)A(R)F(.); DIR BMTH \<< { Add \<< IB2\-> + \->IB \>> } { Sub \<< IB2\-> - \->IB \>> } { Mul \<< IB2\-> * \->IB \>> } { Div \<< IB2\-> / \->IB \>> } BBASE DUP "B" SWAP + SWAP { \<< 'BBASE' STO BMTH \>> } + 2 \->LIST { CONV \<< DUP IF TYPE 0 == THEN \->IB ELSE IB\-> END \>> } 6 \->LIST TMENU \>> \->IB \<< DUP IF TYPE 0 == THEN "" SWAP WHILE DUP REPEAT DUP BBASE MOD 1 + BSTR SWAP DUP SUB ROT + SWAP BBASE / IP END DROP END \>> IB\-> \<< DUP IF TYPE 2 == THEN 0 SWAP DUP SIZE 1 - 0 SWAP FOR j DUP DUP SIZE j - DUP SUB BSTR SWAP POS 1 - BBASE j ^ * ROT + SWAP NEXT DROP END \>> \->IB2 \<< \->IB SWAP \->IB SWAP \>> IB2\-> \<< IB\-> SWAP IB\-> SWAP \>> BBASE 16 BSTR "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" END