C Programming - Floating Point Issues - Discussion
Discussion Forum : Floating Point Issues - General Questions (Q.No. 7)
7.
The binary equivalent of 5.375 is
Discussion:
76 comments Page 6 of 8.
Karan said:
1 decade ago
5.375
here know 5=101
now for 0.375
0.375
*2
____________=0 .collect top to bottom
.
0.750 .
*2 .
____________=1 .
1.500
0.500
*2
____________=1
1.000
here know 5=101
now for 0.375
0.375
*2
____________=0 .collect top to bottom
.
0.750 .
*2 .
____________=1 .
1.500
0.500
*2
____________=1
1.000
Mahi said:
1 decade ago
Nice answer vinoth thank you.
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
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
Sankar said:
1 decade ago
Q.The binary equalent of 5.375 is ..........
ans1)
5 binary equalent is 101
0.375 binary equalent is 3-011
7-111
5-101
take the first bit of 3,7,5 that is 011
so total correct ans is 101.011
ans1)
5 binary equalent is 101
0.375 binary equalent is 3-011
7-111
5-101
take the first bit of 3,7,5 that is 011
so total correct ans is 101.011
Srinu said:
1 decade ago
The above ans like this also..
2/375(1)
2/187(1)
3/93(0)
2/31(1)
3/15(0)
2/5(1)
2/2(0)
1
finally result is:10101111->101.011
2/375(1)
2/187(1)
3/93(0)
2/31(1)
3/15(0)
2/5(1)
2/2(0)
1
finally result is:10101111->101.011
Amar said:
1 decade ago
@Susmita
Nice explanation.
Nice explanation.
Atul said:
1 decade ago
Thank you surya.
Barun singh said:
1 decade ago
@surya.
Your explanation is nice one.
Your explanation is nice one.
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.
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.
Mrudula said:
1 decade ago
Why should we write only the decimal part from botom to top, it seems some more explanation is need to be there.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers