当我使用 multu 乘以浮点数时,我应该忽略 LO 寄存器中的结果吗?
在我们的项目中,我们从用户那里获取两个浮点数,将它们存储在整数寄存器中,并将它们视为 IEEE 754 单精度浮点数,通过掩码操作这些位。因此,在我将 23 位小数值相乘之后,如果我想返回一个单精度浮点数(32 位)作为乘积,是否应该考虑放置在 LO 寄存器中的结果?
In our project, we take two floats from the user, store them in integer registers, and treat them as a IEEE 754 single precision floats, manipulating the bits by masking. So after I multiply the 23 bits of fraction value, should I take into account the result placed in the LO register if I want to return a single precision float (32 bits) as the product?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,我希望您指的是 24 位值,因为您需要在乘法中包含隐式尾数位。
其次,如果您希望乘法正确舍入(如 IEEE-754 中所示),您(有时)需要乘法的低部分才能提供正确的舍入结果。
另一方面,如果您不需要实现正确的舍入,并且在乘法之前左移分数位,则您将能够忽略结果的低位字。
First off, I hope you mean 24 bits of value, since you'll need to include the implicit mantissa bit in your multiplication.
Second, if you you want your multiplication to be correctly rounded, as in IEEE-754, you will (sometimes) need the low part of the multiply in order to deliver the correct rounded result.
On the other hand, if you don't need to implement correct rounding, and you left-shift your fraction bits before multiplication, you will be able to ignore the low word of the result.