C Programming - Floating Point Issues - Discussion

Discussion Forum : Floating Point Issues - General Questions (Q.No. 7)
7.
The binary equivalent of 5.375 is
101.101110111
101.011
101011
None of above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
76 comments Page 1 of 8.

Ajinkya said:   1 decade ago
For converting any Decimal Number to its equivalent Binary Number:

1) For the Integer part of the Number(Before Decimal Point):

Divide that Number by 2 (Eg. 5%2) till the quotient is 1 and note down the remainders in each division (either 0 or 1). When you reach 1, then stop and in the Remainder column, write 1 at the bottom. Then, for your integer part answer, write it from bottom to top.

2) For the Decimal part of the Number(After Decimal Point):

Multiply that Number by 2 (Eg. 0.375*2) till the answer reaches 1. But when you multiply by 2, remove the integer part of the answer and write it down in one column and then multiply the decimal part of the answer by 2 till you reach 1. And when you reach 1, then stop and your answer will be in the same order as that of the numbers that you had written in the column mentioned above.

Eg.) 5.375 : Ans.) 101.011

1) Firstly, integer part is : 5

So,
Remainder
5/2 = 1 (Bottom-Top Approach)
2/2 0
1 1
(As 1 is reached, STOP!!!)

Hence, Binary Equivalent of 5 = 101

2) Now for the Decimal Part: 0.375

Multiplication Answer
0.375*2 = 0.75 0 (Top-Bottom Approach)
0.75*2 = 1.50 1
0.50*2 = 1.00 1
(As 1 is reached, STOP!!!)

Hence, Binary Equivalent of 0.375 = 0.011

Therefore, Binary Equivalent of 5.375 = 101.011.

Hope this helps... :).
Keep Posting....

Sushmita said:   1 decade ago
In decimal numbers, the digits have values that are powers of ten. Starting at the implied decimal point and working to the left, the number 403 is equal to:
3 x 100 + 0 x 101 + 4 x 102 = 3x1 + 0x10 + 4x100 = 3 + 0 + 400

In binary, the digits have values that are powers of two. Working to the left as before, the number 101 is equal to:
1 x 20 + 0 x 21 + 1 x 22 = 1x1 + 0x2+ 1x4 = (in decimal) 1 + 0 + 4 = 5
So, 1111 1111 = 1x1 + 1x2 + 1x4 + 1x8 + 1x16 + 1x32 + 1x64 + 1x128 = 255.

This also works to the right of the decimal point, but the powers of two are negative (i.e., fractions), so 101.011 in binary is:
1x1/8 + 1x1/4 + 0x1/2 + 1x1 + 0x2 + 1x4 = 5.375

Where the first digit to the right of the decimal point is 2-1 (one-half, or 1/2), the next is 2-2 (1/4), then 2-3 (1/8), etc.

DIGANT said:   1 decade ago
For the Floating point number to binary of 5.375.

Step 1 : Divide the number into 2 parts:

1. BEFORE FLOATING POINT.
2. AFTER FLOATING POINT.

Step 2 : Find out the binary of Number BEFORE FLOATING POINT.

5 ---> 101

Step 3 : Find out the binary of Number AFTER FLOATING POINT.

0.375 * 2 -> 0.750 ---> 0
0.750 * 2 -> 1.50 ---> 1
(now remove the non-zero number before floating point)
0.50 * 2 -> 1.00 ---> 1

Step 4 : Now read number from bottom to top.

(110).

Step 5 : Put the number together with floating point.

(101 . 110) -------> ANSWER.

Vinoth.M said:   1 decade ago
Convert decimal to binary(divide decimal number by 2)
->5/2 quotient=2 remainder=1
->2/2 quotient=1 remainder=0
->1/2 quotient=0 remainder=1
In decimal numbers take remainders from bottom to top so binary equivalent of decimal no 5 is 101
Then take fractional part.Here we can convert fractional no to binary by multiply it by 2
So,->0.375*2=0.750 decimal part=0
->0.750*2=1.50 decimal part=1(omit decimal part)
->0.5*2=1.0 decimal part=1
Here we take decimal part from top to bottom.So binary equivalent of 0.375 is 011
Finally 5.375->101.011

Madhava Rao said:   1 decade ago
5.375 is in decimal form.
5=101(In binary format).

Now we have to convert 0.375 into binary format as below.

0.375 * 2 = 0.750 ---> 0 (take the before .(dot) value .i.e Integer value).
0.750 * 2 = 1.500 ---> 1 (take the before .(dot) value .i.e Integer value).

*Note: if we got 1. Some value then remove the 1 value .i.e 0.500.

0.500 * 2 = 1.000 ---> 1 (take the before .(dot) value .i.e Integer value).

*Note: The above Process will be continue until we got fractional part will be getting 0(zero).

So,
0.375 = 011.

So,
5.375 = 101.011.

Poonamchandra said:   1 decade ago
That depends on upto how many digits you want after decimal.

3.02

3------->011

If you want 4 digits after decimal, then solution will be:

0.02*2=0.04------->0
0.04*2=0.08------->0
0.08*2=0.16------->0
0.16*2=0.32------->0

3.02 = 11.0000

and 8 digits after decimal then solution will be:-

0.02*2=0.04------->0
0.04*2=0.08------->0
0.08*2=0.16------->0
0.16*2=0.32------->0
0.32*2=0.64------->0
0.64*2=1.28------->1
0.28*2=0.56------->0
0.56*2=1.12------->1

3.02 = 11.00000101

Prakash said:   1 decade ago
5.375

5 --> 101

0.375 * 2 = 0.75
0.75 * 2 = 1.5
0.5 * 2 = 1.0
Here the binary position like
.. 32 16 8 4 2 1
........................
1 1 = who is 1 add it that is 4+1=5. ok then remaing point matter

.375
in binary point conversion of divide by 2
and then LSB and MSB
0.375 *2 = 0.75 consider that 0
0.75 * 2 = 1.5 consider that 1
0.5 * 2 = 1.0 consider that 1
top to down
that is 011
and 5 is
101.011

Vijaygodaraa said:   1 decade ago
5.375.

First convert 5 into binary as,

(5/2)=quotient(2) and remainder (1).
(2/2)=quotient(1) and remainder (0).
(1/1)=quotient(1) and remainder (1).

Therefore 5 = 101 (write remainder from bottom to top).

Now convert 0.375 into binary as,

0.375 * 2 = 0.75,
0.75 * 2 = 1.5,
0.5 * 2 = 1.0,

Do it until we don't get an integer.
(write remainder from top to bottom).

Therefore the answer is 5.375=101.011.

Firdous Sadaf Mohd Ismail said:   1 decade ago
5.375
first convert 5 into binary as
(5/2)=quotient(2) and remainder (1)
(2/2)=quotient(1) and remainder (0)
(1/1)=quotient(1) and remainder (1)
therefore 5 = 101 (write remainder from bottom to top)

Now covert 0.375 into binary as
0.375 * 2 = 0 .75
0.75 * 2 = 1 .5
0.5 * 2 = 1 .0
(write remainder from top to bottom)

Therefore the answer is 5.375=101.011

Ankit said:   1 decade ago
5 is equivalent to 101. The main problem is relate with floating points values.
0.375*2
0.750*2=write the digit left to the decimal point i.e.=0
1.500*2=write the digit left to the decimal point i.e.=1
0.500*2=write the digit left to the decimal point i.e.=1
1.000
Now combine the binary values:
(5.375)base 10=(101.011)base 2


Post your comments here:

Your comments will be displayed after verification.