🏗️ Float Builder

Số thực dạng IEEE 754 single precision gồm 32 bit chia làm 3 khu: Sign (1 bit), Exponent (8 bit, lệch 127) và Mantissa (23 bit, phần sau dấu chấm của 1.xxx).

An IEEE 754 single-precision float has 32 bits in 3 fields: Sign (1 bit), Exponent (8 bits, biased by 127) and Mantissa (23 bits, the part after the point of 1.xxx).

Lắp thử −6.75 theo đúng 5 bước trên slide, rồi làm ngược lại: nhìn 32 bit và đọc ra số thực.

Build −6.75 following the 5 steps on the slides, then go the other way: look at 32 bits and read the real number.

5 bước mã hóa (slide 65)

  1. Dấu: âm thì Sign = 1, dương thì Sign = 0.
  2. Đổi |x| sang nhị phân: 6.75 = 110.11
  3. Chuẩn hóa: dời dấu chấm để còn đúng một chữ số 1 phía trước: 110.11 = 1.1011 × 2²
  4. Exponent = số mũ + 127 = 129 = 10000001
  5. Mantissa: chép phần sau dấu chấm (1011) rồi thêm 0 cho đủ 23 bit. Số 1 phía trước không cần lưu.
  1. Sign: negative gives Sign = 1, positive gives Sign = 0.
  2. Convert |x| to binary: 6.75 = 110.11
  3. Normalise: move the point so exactly one 1 is in front: 110.11 = 1.1011 × 2²
  4. Exponent = exponent + 127 = 129 = 10000001
  5. Mantissa: copy the part after the point (1011) and pad with 0s to 23 bits. The leading 1 is not stored.

Giải mã thì đi ngược: (−1)Sign × 1.Mantissa × 2Exponent − 127.

Decoding goes backwards: (−1)Sign × 1.Mantissa × 2Exponent − 127.

Bấm vào bit để bật/tắt. Mỗi bước đúng ngay lần đầu +4 điểm, dùng gợi ý −2.

Click a bit to toggle it. +4 for each step right on the first try, −2 for using a hint.