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:
PHP Code:
<script type="text/javascript">
var myNum = "11011"
var newNum = parseInt(myNum, 2)
alert(newNum)
</script>
Last edited by steelersfan88; 03-20-2004 at 09:41 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
if($neil=="stuck"){echo("Help!");
pull_out("hair", $neil);
$neil=bald;}
else{echo("What do you want?");}
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
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
Last edited by GreatMagicalHat; 04-21-2005 at 01:34 PM.
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:
Bookmarks