You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**Amartyanil****Member**- From: Universe
- Registered: 2013-05-27
- Posts: 51

Hi;

How to convert:

I. Decimal to Binary and vice versa

*Last edited by Amartyanil (2016-02-05 20:24:39)*

"You can never be too old or too young. A person's age is irrelevant." - bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 100,332

Hi Amartyanil;

By hand or by computer?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.** **Thinking is cheating.**

Offline

**Amartyanil****Member**- From: Universe
- Registered: 2013-05-27
- Posts: 51

Hi bobbym;

By hand

"You can never be too old or too young. A person's age is irrelevant." - bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 100,332

Not even a calculator?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.** **Thinking is cheating.**

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 15,955

You don't need a calculator for that.

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 100,332

Hi;

Maybe for very small numbers but everything is easier when you have a little computing power.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.** **Thinking is cheating.**

Offline

**Amartyanil****Member**- From: Universe
- Registered: 2013-05-27
- Posts: 51

Hi bobbym;

First tell it by hand; then a calculator

"You can never be too old or too young. A person's age is irrelevant." - bobbym

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 100,332

The way I do it is by making a little table of powers of 2.

2^0 = 1

2^1 = 2

2^2 = 4

2^3 = 8

2^4 = 16

2^5 = 32

2^6 = 64

2^7 = 128

Now supposing we want to change 105 from binary to decimal. We get the closest power of 2 that is smaller or equal. We see in the above chart that it is 2^6 = 64. So put a 1 and subtract 105 - 64 = 41.

Now just go down the line does 2^5 fit in 41? Yes it does so add a 1 next to that 1.

11 and say 41 - 32 = 9

2^4 is larger than 9 so put a 0 next to that 1.

110

2^3 is smaller than 9 so put a 1

1101 and say 9 - 8 = 1

2^2 is larger than 1 so put a 0

11010

2^1 is smaller than 1 so put a 0

110100

2^0 is exactly equal to 1 so put a 1

1101001 and say 1 - 1 = 0

We are done.

105 = 1101001 in binary

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.** **Thinking is cheating.**

Offline

**bob bundy****Moderator**- Registered: 2010-06-20
- Posts: 7,442

hi Amartyanil

If I have to do this by hand, here's the method I'd use for any number base.

Step 1. work out the column headings for that base.

Step 2. Starting with the biggest of these, subtract as many times as possible, then

Step 3, 4 etc continue with the lower powers until I'm down to units.

eg. Change 1123 into base 8

Step 1 the headings are 1, 8, 64, 512, .... I can see by inspection that 512 is as high as I'll need to go.

Step 2. 1123 - **2***512 = 99 so the number in the '512' column will be **2**

Step 3. 99 - **1***64 = 35 so the number in the '64' column will be **1**

Step 4. 35 - **4***8 = 3 so the number in the '8' column will be **4**

Step 5. As my remainder is now less than 8 the number in the 'units' column will be **3**

Final answer 1123 in base 10 is 2143 in base 8

Screen shot below shows the steps more neatly and how I checked that I'd got it right.

And here's a quick way to change that to binary.

In binary the first three columns are 4, 2 and 1

So you can change each octal digit into a 3 digit binary number thus

2143 becomes 010 001 100 011 and there's the binary version.

check 1 + 2 + 32 + 64 + 1024 = 1123

Bob

Children are not defined by school ...........The Fonz

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 100,332

Hi all;

Or as the Russian do?!

To change 530 to binary.

Make this grid:

The first column was created by dividing 530 by 2 and if there was a remainder ignoring it. The second column was created by the rule if the number next to it is even put a 0, if odd, put a 1.

Now start from the bottom

530 decimal = 1000010010 binary.

Lets do another one.

11571 decimal = 10110100110011 binary

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.** **Thinking is cheating.**

Offline

Pages: **1**