Click to See Complete Forum and Search --> : TI-83 Calc - Converting Binary to Decimal
neil9999
03-20-2004, 08:50 AM
Hi,
Does anyone know how to convert Binary numbers (eg. 11001) to Decimal numbers (eg. 25) using a program on a TI-83?
Thanks,
Neil
steelersfan88
03-20-2004, 09:01 AM
not sure of how the code would go, but:
i would loop for each digit starting on the right, and keep a running total of the number. If the number is a 1, add 2^character position (ones digit=1,10s digit=2,...). Loop until the last character is reached.
Here is a javascript that will do that, if you want to try changing it to fit the ticalc:<script type="text/javascript">
var myNum = "11011"
var newNum = parseInt(myNum, 2)
alert(newNum)
</script>
neil9999
03-20-2004, 09:34 AM
The only problem is I'm not sure the calc can get individual digits from a variable. Is there one? Or is there another way of doing so?
Thanks,
Neil
steelersfan88
03-20-2004, 10:01 AM
Try this link, maybe this will do it: here (http://www.ticalc.org/archives/files/fileinfo/55/5547.html)
neil9999
03-20-2004, 10:07 AM
Thanks, but it looks like that is programed in BASIC. The calculator has it's own programming language, which I am using.
Thanks,
Neil
AdamGundry
03-20-2004, 12:31 PM
Yes, the calculator has it's own programming language - TI-83 BASIC. As far as I can see, that program should be suitable, as should this one (http://www.ticalc.org/archives/files/fileinfo/120/12070.html).
Adam
neil9999
03-20-2004, 04:47 PM
Wow - I downloaded that last Zip and looked in HEX.83G and it looked nothing like the TI programming language I'm used to. Maybe I need some special program to view it properly. Is there a mathamatical formula to convert binary to dec? I've got a programme which converts decimal to binary.
Thanks for your help,
Neil
do you have the silver edition, or regular?
neil9999
03-20-2004, 05:04 PM
I have the TI-83 Plus.
Thanks,
Neil
the reason its not showing is because you don't have the TI-83 fonts installed on your computer, you'll need to do that then open it up in word... or the TI software
neil9999
03-22-2004, 12:29 PM
Not to worry - I've invented my own. It converts bases 2-9 to base 10 (Normal). Here it is. -> is store.
Lbl 0
ClrHome
Disp "ENTER NUM"
Prompt A
Disp "Base:"
Prompt F
A->E
ClrHome
Output(1,1,E)
0->C
1->D
While A>0
round(0.1A,0)*10->B
D(A-B)+C->C
0.1B->A
FD->D
End
Output(8,1,C)
Pause
Menu("AGAIN?","YES",0,"NO",1)
Lbl 1
Stop
Neil
neil9999
03-22-2004, 02:01 PM
Error discovered, wont work for bases above 5.
Neil
Juuitchan
04-14-2004, 03:13 AM
Try "Int" or "Floor" or something instead of "Round". Does that fix it?
GreatMagicalHat
04-21-2005, 02:28 PM
You could make the user's binary number be stored in a string and then use sub() to get numbers out of that string.
The only problem is that you would get "1" instead of 1 (or "0" instead of 0)
I don't know function in Basic to convert the "1" to the 1 (SURE WOULD LIKE TO KNOW A WAY), so you would have to do it like this
Input "binary number",str1
length(str1)->A
0->R
for(i,1,A)
If sub(str1,i,1)="1"
R+2^(i-1) -> R
end
Disp R
Oops, now I wrote the complete program for you, oh well...
EDITED to get out a little bug (which I made due to the little time I took to write it)
EDITED I mistyped the correction :rolleyes:
Cheatachu72
12-15-2005, 04:25 PM
Input "binary number",str1
length(str1)->A
0->R
for(i,1,A)
If sub(str1,i,1)="1"
R+2^(i-1) -> R
end
Disp R
sorry to drag up a thread from the dead, but searching google to find a simple binary conversion program for the ti-83 i stumbled upon this site. This code ALMOST works properly, there is just one little mistake. When the ti puts the number into a string the msb of the binary number is given the string position of 1. With your code the msb is given the least weight. For this to be fully functional you would want to use:
Input "binary number",str1
length(str1)->A
0->R
0->i
for(i,1,A)
If sub(str1,i,1)="1"
R+2^(A-I) -> R
end
Disp R
chrismartz
12-19-2005, 03:12 PM
Why exactly do you need a program to do this? Should be able to go to at least 50 in your head with binary.
acorbelli
12-19-2005, 03:24 PM
You guys know that there's a function in the 83-plus catalogue which will convert binary->decimal and decimal->binary for you. I don't remember it right now, but it's in your instruction booklet.