Re: A92: Binary and Decimil Conversion

```
i know i shouldn't do this...but i have to gloat
this was posted on the 82 list originally, and since i made the program
on the 92, i had to post it here.

decimal(a,b,c):func
local d,e,f,g,h
0->e:""->g:if b=10 then:expr(a)->e:goto skip:endif
for h,1,dim(a)
ord(mid(a,h,1))-48->d:if d>9:d-7->d
if d>35:d-6->d:e+d*b^(dim(a)-h)->e
endfor:lbl skip
ceiling(log(e)/log(c))+1->f:if c=10:return string(e)
for h,f-1,0,-1
int(e/c^h)->d:e-d*c^h->e
if d>9:d+7->d:if d>42:d+6->d
g&char(d+48)->g
endfor:return g
endprgm

this program translates "a" string from the current "b" integer type
(binary=2, decimal=10...etc.  2-63 is the range) to a different "c"
integer type...so to change 10 decimal into binary do the following:
decimal("10",10,2) and it returns "0A" i believe

hope this helps some people...if not then flame me

-Rob

>Here is basic progs I wrote, I will translate them into assembly as my
>first project!!! =)   =)    =)
>They're in UUE, so someone who can decode them, please repost them as
>attached files as many on the list cannot seem to use UUE format.
>Thanks.  I hope there is not already a program like this.
>~Larry C
>Larry1492@juno.com
>http://www.geocities.com/SiliconValley/Lab/9888
>
>
>_____________________________________________________________________
>Get completely free e-mail from Juno at http://www.juno.com
>Or call Juno at (800) 654-JUNO [654-5866]
>
>
>Attachment converted: Macintosh HD:BINDECCV.ZIP (????/----) (000124A5)

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

```