View Full Version : 6.25 -> binary

alpha

09-09-2003, 09:05 PM

I need some help with this. I'm not sure if I did it right, but converting decimal 6.25 to binary, I got 110010011. Is this right?

I was just able to print the homework today, and I have a class tomorrow during my prof's office hours.

I tried to do it with the divide by two method, so I'm not sure if it's right. I need help on how to convert decimal to binary when it has a decimal point. Thanks.

confuted

09-09-2003, 09:15 PM

6 in base 2 is

110

25 in base 2 is

11011

I don't know how to do the decimal though... unless you're using fixed point numbers. In a fixed point 8.8 representation, it would be

00000110 00011011 (I think)

Jeremy G

09-09-2003, 09:40 PM

Heh. Binary conversions are easy.

6

0 1 1 0

8 4 2 1

.25

0 1 0 0

1/2 1/4 1/8 1/16

so - 0110.0100

This is straight from Logic and Computer Design Fundementals by Mano book:

conversions of decimal fractions to binary:

(0.6875)10 -> binary

0.6875 x 2 = 1.3750 MSD = 1

0.3750 x 2 = 0.7500 MSD = 0

0.7500 x 2 = 1.5000 MSD = 1

0.5000 x 2 = 1.0000 MSD = 1

so...

(0.6875)10 = (0.1011)2

hope this helps you out,

axon

P.S. dbgt is right!

alpha

09-10-2003, 01:32 AM

Originally posted by dbgt goten

Heh. Binary conversions are easy.

6

0 1 1 0

8 4 2 1

.25

0 1 0 0

1/2 1/4 1/8 1/16

so - 0110.0100 that looks good, but i think i need a little more explanation of what you are doing here. i get the 1 `2 4 8 etc stuff, but the 0s and 1s that corresponds are kindof confusing me right now.

Originally posted by axon

This is straight from Logic and Computer Design Fundementals by Mano book:

conversions of decimal fractions to binary:

(0.6875)10 -> binary

0.6875 x 2 = 1.3750 MSD = 1

0.3750 x 2 = 0.7500 MSD = 0

0.7500 x 2 = 1.5000 MSD = 1

0.5000 x 2 = 1.0000 MSD = 1

so...

(0.6875)10 = (0.1011)2

hope this helps you out,

axon

P.S. dbgt is right! That times two thing looks familiar. Let me get this straight; you multiply the part behind the decimal point times two and the coefficient is what your binary number digit will be? and then you just do the part behind the decimal point no matter the coefficient?

glUser3f

09-10-2003, 06:08 AM

OK, I'll try to explain how to represent decimal floating point numbers in binary here.

you know how to convert integers like 163 which can be written this way:

263 = 3 * 10^0 + 6 * 10^1 + 2 * 10^2

now the same applies to floating point numbers:

0.196 = 1 * 10^-1 + 9 * 10^-2 + 6 * 10^-3

Now representing floating point numbers in binary goes exactly the same way, except that we use a base of 2 instead of 10, so:

(0110.0100)2 = 0*2^3 + 1*2^2 + 1*2^1 +0*2^0 + 0*2^-1 + 1*2^-2 + 0*2^-3 +0*2^-4

= 0 + 4 + 2 + 0 + 0 + 0.25 + 0 + 0 = (6.25)10

edit:

looks like I can't use html here

Originally posted by alpha

Let me get this straight; you multiply the part behind the decimal point times two and the coefficient is what your binary number digit will be? and then you just do the part behind the decimal point no matter the coefficient?

yes, that is correct. Notice that after multiplying the fraction by 2, the result will always either have a 1.something or a 0.something, nothing else.

axon

Jeremy G

09-10-2003, 06:24 PM

Originally posted by alpha

that looks good, but i think i need a little more explanation of what you are doing here. i get the 1 `2 4 8 etc stuff, but the 0s and 1s that corresponds are kindof confusing me right now.

Basicly we know that to the left of a decimal binary digits represent a value of double the previous digit. IE:

1, 2, 4, 8, 16, 32, 64, 128 etc

But to the right of the decimal its the same thing, but with 1 over the value IE:

1/2, 1/4, 1/8, 1/16, 1/32, 1/64, 1/128 etc

All these values are fractions:

1/2 = .5

1/4 = .25

etc.

This conversion method is better used from binary to decimal and not vice versa - becuase when coming from decimal to binary you arnt garanteed a nice decimal value.

convert 1.11 to decimal:

1 + 1/2 + 1/4 = 1.75

The only reason I converted from decimal to binary was becuase I recognized .25 as the easy 1/4.

Powered by vBulletin® Version 4.2.5 Copyright © 2019 vBulletin Solutions Inc. All rights reserved.