CMU Computer Systems: Floating Points

本文深入探讨了IEEE 754标准在浮点数表示中的应用,包括单精度和双精度格式。详细介绍了规范化值、非规范化值以及特殊值(如无穷和NaN)的编码方式。还讨论了浮点数运算的精确性、舍入模式,并强调了其数学特性,如非交换性和非结合性。此外,提到了浮点数乘法和加法的实现及问题修复策略。
摘要由CSDN通过智能技术生成

Fractional binary numbers

IEEE Floating Point
  • IEEE Standard 754
    • Sign + Exp + Frac
  • Driven by numerical concerns
Precision options
  • Single precision: 32bits: 1+8+23
  • Double precision: 64bits: 1+11+52
Normalized Values
  • Exp not 000…00 or 111…11
  • Exponent coded as a biased value: E = Exp-Bias
  • Significand coded with implied leading 1: 1.xxxx…x
Denormalized Values
  • Exp is 000…0
  • Exponent value: E = 1-Bias
  • Significand coded with implied leading 0: 0.xxx…x
Special Values
  • Exp all 1, and frac is all 0, infinity number
  • Exp all 1, and frac not 0, NaN, not a number
Special Properties of the IEEE Encoding
  • FP Zero Same as Integer Zero
  • Can Use Unsigned Integer Comparison
Rounding
  • Towards zero
  • Round down
  • Round up
Nearest Even (default)
  • Greater than half round up
    • Less than half round down
    • And half round near the even
  • FP Multiplication
    • Exact Result
    • Fixing
    • Implementation
  • FP Addition
    • Exact Result
    • Fixing
  • Multiplication and Addition are commutative and not associative
Summary
  • IEEE Floating Point has clear mathematical properties
  • Represents numbers of form M x 2^E
  • One can reason about operations independent of implementation
  • Not the same as real arithmetic
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值