0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

3. 基数変換①n進数から10進数、10進数からn進数

Last updated at Posted at 2025-02-10

n進数から10進数への基数変換

→各行の数字にその桁の重みを掛け算する

2進数1101.011を10進数へ変換
整数部
1×8(←桁の重み)=8
1×4=4
0×2=0
1×1=1 8+4+0+1=13

小数部
0×1/2=0
1×1/4=0.25
1×1/8=0.125  0+0.25+0.125=0.375
13+0.375=13.375←1101.011を10進数に変換した数

 

10進数からn進数への基数変換

・重みを使う方法
 左から順に桁の重みを使って割り算していく(省略)

・割り算と掛け算を使う方法
 基数を使って整数部は割り算、小数部は掛け算する

13.375を2進数に変換
整数部
10進数を基数で割って、その商をまた基数で割るを繰り返す。
13÷2=6余り1
6÷2=3余り0
3÷2=1余り1
1÷2=0余り1  商が0になったので終了
 ↑整数部は余りを下から並べ直す ☆1101

小数部
小数部が0になるまで基数で掛け算を繰り返す
2×0.375=0. 75
2×0.75=1.5
2×0.5=1.0 小数部が0になったので終了
   ↑小数部は掛け算した結果の整数部分を上から並べる ☆011

答 1101.011

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?