CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@SheldonCooper • 19 Jul, 2011
How to convert the decimal number (41.7500) to binary?Please explain with answer.
@narayana murthy • 19 Jul, 2011 its simple divide it with 2
i mean lcm like this
number/2 then divide obtained number with 2 and goes upto it comes 1 or 0
now write the numbers on line you will get binary number
@SheldonCooper • 19 Jul, 2011 What about the numbers after dot?And also what is the answer?
@pradeep_agrawal • 20 Jul, 2011 Currently IEEE-754 is being used as standard for storing decimal numbers (or rather say float point numbers) in memory. Refer Floating point - Wikipedia, the free encyclopedia for more details on floating point number and its binary representation.

-Pradeep
@PraveenKumar Purushothaman • 20 Jul, 2011 The number 41.7500 can be expressed as:
32 + 8 + 1
So, the answer is: 101001
@PraveenKumar Purushothaman • 20 Jul, 2011 Converting Decimal Fractions to Binary

Converting Decimal Fractions to Binary

In the text proper, we saw how to convert the decimal number 14.75 to a binary representation. In this instance, we "eyeballed" the fractional part of the binary expansion; 3/4 is obviously 1/2 + 1/4. While this worked for this particular example, we'll need a more systematic approach for less obvious cases.

In fact, there is a simple, step-by-step method for computing the binary expansion on the right-hand side of the point. We will illustrate the method by converting the decimal value .625 to a binary representation..

Step 1: Begin with the decimal fraction and multiply by 2. The whole number part of the result is the first binary digit to the right of the point.

Because .625 x 2 = 1.25, the first binary digit to the right of the point is a 1.
So far, we have .625 = .1??? . . . (base 2) .

Step 2: Next we disregard the whole number part of the previous result (the 1 in this case) and multiply by 2 once again. The whole number part of this new result is the second binary digit to the right of the point. We will continue this process until we get a zero as our decimal part or until we recognize an infinite repeating pattern.

Because .25 x 2 = 0.50, the second binary digit to the right of the point is a 0.
So far, we have .625 = .10?? . . . (base 2) .

Step 3: Disregarding the whole number part of the previous result (this result was .50 so there actually is no whole number part to disregard in this case), we multiply by 2 once again. The whole number part of the result is now the next binary digit to the right of the point.

Because .50 x 2 = 1.00, the third binary digit to the right of the point is a 1.
So now we have .625 = .101?? . . . (base 2) .

Step 4: In fact, we do not need a Step 4. We are finished in Step 3, because we had 0 as the fractional part of our result there.

Hence the representation of .625 = .101 (base 2) .

You should double-check our result by expanding the binary representation.
@SheldonCooper • 20 Jul, 2011 Re: Converting Decimal Fractions to Binary

Thanks Praveen.So is the final answer (101001.101)2 ?
@PraveenKumar Purushothaman • 20 Jul, 2011 Yup! Right buddy... 😀
@mihaidobos • 05 Aug, 2011 I'll give a part of an older article I wrote on a website about subnetting, for teaching you how to fish instead of giving you a kg of fish 😀. This is yet another method that works best on small decimal numbers (less then 1 byte usually).

A) Binary to decimal conversion

To fully understand these kind of transformations, you should firstly know these values:

2^0 = 1
2^1 = 2
2^2 = 4
2^3 = 8
2^4 = 16
2^5 = 32
2^6 = 64
2^7 = 128
2^8 = 256
(will refer to this as Table A.)

Now how do we transform binary to decimal?

Let's take the number 10100110 which is in binary (ones and zeros) and transform it to decimal.

We just take all values and form a table, starting with 2^0 (lowest value) from the right position of our binary number. (you'll do this only the first times, after some practice you'll do it mentally with no problems):

1 0 1 0 0 1 1 0
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0

Now we count only the values with a one (1) above and calculate their sum.
The result is 2^7+2^5+2^2+2^1=(using Table A.)=128+32+4+2=166
So 10100110 (binary) = 166 (decimal).


B) Decimal to binary conversion

For this transformation you also need the values in Table A.

Let's take for example the number 240 and try to find out the binary equivalent.
The main idea behind this is to try to write the decimal number as a sum of numbers in Table A. (exponential powers of 2).
The easiest way is this:

Find the highest number that can be written as a power of 2 that is smaller or equal then our decimal number (from Table A).

256 is the highest, but its bigger than our number (240) so it's not good. Next is 128 which matches our criteria.

Subtract 128 from 240: 240 - 128 = 112
Note the number 128 down.

Now do the same for 112. Find the highest number in Table A smaller then 112. This value will be 64.
Subtract: 112 - 64 = 48.
Note the number 64 down.

Find the highest value smaller than 48 in Table A. It's 32.
Subtract: 48 - 32 = 16
Note 32 down.

Now 16 is a an exponential power of two, it's the highest value in Table A smaller or equal to 16 so we stop. Note 16 down too.

Put all numbers noted down:
128+64+32+16=240 our number. We managed to write our decimal number as a sum of exponentials powers of 2.

Now write all values from 2^0 to 2^7 (one byte long data). Write the decimal equivalent of our noted down numbers, and put ones (1) under them. Put zeros under the numbers we didn't noted down.

2^7(128) 2^6(64) 2^5(32) 2^4(16) 2^3 2^2 2^1 2^0
1 1 1 1 0 0 0 0

The number in ones and zeros you obtains is the binary equivalent of the decimal.
SO 240 (=2^7+2^6+2^5+2^4) = 11110000.


Best regards,

Mihai


Source: https://www.tutorial5.com/content/view/89/79/
@Reya • 05 Aug, 2011 @Mihiadobos: Mention the source 😀
@mihaidobos • 05 Aug, 2011
praveena211
@Mihiadobos: Mention the source 😀

woups sorry. Edited. I was thinking it will be considered as spam since it links back to a website I partially own.


Thx,

/MD
2k views

Related Posts

@Radhika Deshpande · Dec 1, 2016

Born and brought up in Hyderabad, Kranthi Kumar hails from a lower middle-class family. In the neighborhood he grew up, an academic bent of mind led a person to lead...
2k views

@naveee · Dec 7, 2012

Can someone tell me why is transformer efficiency is higher than motor and generator? Transformer efficiency is generally greater than 95%, while that of the motors its ~70%. Both are...
9.9k views

@Sharvari Panchbhai · Feb 14, 2015

Last year, NASA had announced its proposal to develop a conceptual design of a possible submersible autonomous vehicle (submarine) for performing autonomous detailed scientific investigations of the liquid methane/ethane seas...
2k views

@Ankita Katdare · Aug 15, 2014

Mahindra Two Wheelers India has launched a new ride for the Indian roads with Mahindra Rodeo UZO 125. Priced at Rs. 47,957 - the new top-end two wheeler packs inside...
2.8k views

@Raagavan Sivaraja · Jan 10, 2016

Nikon gave shutterbugs a good time at the CES this year by announcing 3 top of the line cameras including Nikon D5,which is the sequel to its already popular D4....
3.6k views