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?

More than 3 years have passed since last update.

IEEE754の形式例とバイアス値

Posted at

浮動小数点数の形式のもう一つの表現がある。
一桁部分が1になるようにする。
バイアスという補正を使い、指数にマイナスが出ないようにする。
(大小関係をわかりやすくするために)

例 0.011の場合

これを1.1^-2(基数は2)にする。

これをIEEE754の形式で表現すると

  • 仮数部の符号はなので0
  • 指数部は-2なのでこれにバイアス(127)をかけて125にする。2進数に直して01111101にする。
  • 仮数部は1なので100...000にする。

以上によって001111101100...000(32ビット)になる。

-5.625を8ビット2進数で表せ。
-0.5625^1になる。

  • 符号はなので1
  • 指数部は
* irb(main):252:0> 2*0.5625
=> 1.125
irb(main):253:0> 2*0.125
=> 0.25
irb(main):254:0> 2*0.25
=> 0.5
irb(main):255:0> 2*0.5
=> 1.0

指数部は1001
1

  • 仮数部は
    .
    .
    .
    わからない

解説を見た。

-5.6252進数で表示させる。
5を1001
0.625を101
指数はないので0
符号をつけて全てを足すと10011010になる。

0.25を正規化し、浮動小数点型式で表示させよ。

符号は正なので0
仮数は25なので01
指数は−1なので1111

0111110...0になる
これは正解した。

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?