フィルターのクリア

Repeating fractional binary to decimal.

5 ビュー (過去 30 日間)
David
David 2013 年 10 月 1 日
コメント済み: David 2013 年 10 月 2 日
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 Center および File ExchangeMultirate Signal Processing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by