Converting Numbers into Binary

Fallental

Rookie
Joined
Apr 30, 2009
Messages
71
Binary was a subject that just popped up on the Jail server so I thought I would share my knowledge :)

I Learned This in Scholars Bowl At Skewl

First things First: Know your bases!

The number system we use everyday is know as BASE 10, Binary is known as BASE 2. There are many other bases, but they are not named.


Base 10

1 10 100 1000 10000 100000 And so on...

Base 2 (Binary)

128 64 32 16 8 4 2 1

Ok So say you want to convert the number 69?

Your first step is to find the largest power of 2 that is less than 69, Which would be 64.

So starting with 64, how many WHOLE times can 64 fit into 69? Once so we Put a 1.

1

Now we take 64 from 69. 69-64= 5

Now to 32, it can't fit into 5 so we put a 0. A zero basically means the next number cannot fit into it.

10

16 can't fit into 5 so put a 0.

100

Next, 8 can't fit into 5 so put a 0.

1000

NOW 4 CAN fit into 5, once so we add a 1.

10001

Subtract 4 from 5. 5-4= 1

On to 2, which cannot fit into one so we put a 0.

100010

And lastly, 1 can fit into 1 once so we put a 1

AND VOILA 69 In Binary is Equal to 1000101

If your not sure how this works :facewall: feel free to comment and ask me to explain more deeply. If you learned something today, please comment, and if you just thought this was cool, comment!
:)
Thanks Fallental
 
I did hear that computers only really do things by adding or subtracting. All other functions are just variations of addition and subtraction. Binary has something to do with that... um

Well, that's the limit of my knowledge. :3
 
I did hear that computers only really do things by adding or subtracting. All other functions are just variations of addition and subtraction. Binary has something to do with that... um

Well, that's the limit of my knowledge. :3

close...computers actually only ADD.
 
close...computers actually only ADD.
They both add and subtract. Even going back to the first electronic computer, the Atanasoff-Berry Computer. Or the later ENIAC computer. Both had add-subtract modules.

Also, for conversion of decimal to binary, the common way is to divide the number by 2 repeatedly. If it divides evenly, you put a 0, if uneven you put a 1 and drop the remainder. Keep on adding them to the front of the binary string. Keep going until you end up with a number smaller than 1 and then slap a 1 on the beginning.

So, the number 69.
69/2=34.5
so you put a 1
34/2=17
so you have 01
17/2=8.5
so you have 101
8/2=4
so you have 0101
4/2=2
so you have 00101
2/2=1
so you have 000101
1/2=0.5
so you end up with 1000101

That's how it's done in Computer Science
 
Last edited:
They both add and subtract. Even going back to the first electronic computer, the Atanasoff-Berry Computer. Or the later ENIAC computer. Both had add-subtract modules.

Incorrect.

At their lowest level, computers cannot subtract, multiply, or divide. Neither can calculators. The world's largest and fastest supercomputer can only add?that's it.

Search the net for "2's complement"

Here is a good read here.. http://www.lauftext.de/cybernetic-computer/subtracting-binarily.htm
 
Incorrect.

At their lowest level, computers cannot subtract, multiply, or divide. Neither can calculators. The world's largest and fastest supercomputer can only add?that's it.

Search the net for "2's complement"

Here is a good read here.. http://www.lauftext.de/cybernetic-computer/subtracting-binarily.htm

You've misread what a two's complement is. Two's complements are a method of encoding negative numbers into binary. Computers able to handle a two's complement are a relatively recent innovation. Most were able to do a one's complement at best.

Creating a two's complement from a one's complement works like this:
To subtract a binary number from another, you invert the number and then add 1. for example:
001100100
+11101001
+00000001
----------
010100110


As for your claim that computers can only add at the lowest level, you may as well claim that computers can't add and can only perform AND/OR/NOT operations as that is what really happens when you add two numbers.

Here's a diagram of an adder:
fulladd.jpg

 
You've misread what a two's complement is. Two's complements are a method of encoding negative numbers into binary. Computers able to handle a two's complement are a relatively recent innovation. Most were able to do a one's complement at best.


As for your claim that computers can only add at the lowest level, you may as well claim that computers can't add and can only perform AND/OR/NOT operations as that is what really happens when you add two numbers.




I have to disagree. The 2's complement representation is used to deal with negative numbers and subtractions (since computers can't actually do anything but add).

Computers use the method of complements to implement subtraction. Using complements for subtraction is closely related to using complements for representing negative numbers, since the combination allows all signs of operands and results; direct subtraction works with two's-complement numbers as well.

In mathematics and computing, the method of complements is a technique used to subtract one number from another using only addition of positive numbers. This method was commonly used in mechanical calculators and is still used in modern computers.
 
They both add and subtract. Even going back to the first electronic computer, the Atanasoff-Berry Computer. Or the later ENIAC computer. Both had add-subtract modules.

Also, for conversion of decimal to binary, the common way is to divide the number by 2 repeatedly. If it divides evenly, you put a 0, if uneven you put a 1 and drop the remainder. Keep on adding them to the front of the binary string. Keep going until you end up with a number smaller than 1 and then slap a 1 on the beginning.

So, the number 69.
69/2=34.5
so you put a 1
34/2=17
so you have 01
17/2=8.5
so you have 101
8/2=4
so you have 0101
4/2=2
so you have 00101
2/2=1
so you have 000101
1/2=0.5
so you end up with 1000101

That's how it's done in Computer Science

My head hurts.. And why would I want to know binary, I already know American. ><
 
OH my lol, Giant debate, I just wanted to show everyone my way of converting numbers into binary, not the computers way, but its a great addition.
 

Latest posts

Back
Top