Skip to main content
  1. Posts/

浮動小数点(Floating Point Binary)まとめ

·134 words·1 min
Binary

IEEE Standard 754 Floating Point Binary の形式
#

UoPeople CS1104 Unit.1 でならったことの復習。 Floating Point Binary は以下の 3 要素でなりたつ。

  • Sign bit = 符号を表すビット。精度に関わらず MSB(Most Significant Bit) が Sign bit として使われる。
  • Exponent, E = 2 の何乗をかけるか。下記の公式で Unsigned Binary として解釈される。
  • Fraction, F = 仮の数を決める。下記の公式で Unsigned Binary として解釈される。

Floating Point Binary は**精度(Precision)**に応じて 2 種類に分けられ、 Exponent と Fraction の桁数が変わる。

  1. Single-Precision
    • 32 bit で構成される。
    • Exponent は 8 bits, Fraction は 23 bits。
    • (±)1.F*2^(E-127) として解釈される
    • 例)1 10101101 01101101011000000000000 なら、
      • Sign bit = 1(-)
      • E = 10101101 = 173
      • F = 01101101011000000000000 より、
      • 1.F*2^(E-127)
        = -1.01101101011*2^46 =-100,433,515,249,664(Decimal) となる。
  2. Double-Precision
    • 64 bit で構成される。
    • Exponent は 11 bits, Fraction は 52 bits。
    • (±)1.F*2^(E-1023) として解釈される

Reference
#

Tarnoff, D. L. (2007). Computer organization and design fundamentals: Examining computer hardware from the bottom to the top (pp. 52–70).