Repeating fractional binary to decimal.

5 次查看(过去 30 天)
Could someone explain to me how to convert the binary decimal (0.1001)2 (repeating) to a decimal in base 10? I know how to do this for regualr binary fractions but not for repeating ones. Thanks.

采纳的回答

Roger Stafford
Roger Stafford 2013-10-1
It isn't clear to me whether you mean a binary number with a pattern that is repeated some finite number of times, or one that is infinitely repeated. I will assume you mean infinitely repeated, as in, say,
.11010110101101011010.....
which repeats infinitely every five binary digits. Let x be the value of the first pattern (.11010 in the example) and n be the number of binary digits in it. Then the value of the infinitely repeating pattern would be:
y = x/(1-2^(-n))
In the above example it would be y = (26/32)/(1-2^(-5)) = 26/31 = .8387096774
There is a similar formula for one repeated a finite number of times.
  3 个评论
Roger Stafford
Roger Stafford 2013-10-1
If m is the number of times the pattern is given, then
y = x*(1-2^(-n*m))/(1-2^(-n))
In the example I gave, if m = 4 for .11010110101101011010, it would be
y = 26/32*(1-2^(-5*4))/(1-2^(-5)) = 26/31*(1-2^(-20)) = .8387088776
Note: These answers assume the binary point is just to the left of the first pattern. If it is elsewhere make the necessary adjustment with the appropriate multiple of a power of 2.
David
David 2013-10-2
Thanks for the response. Great help.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by