当我使用 multu 乘以浮点数时,我应该忽略 LO 寄存器中的结果吗?

发布于 2024-08-03 01:59:18 字数 141 浏览 4 评论 0原文

在我们的项目中,我们从用户那里获取两个浮点数,将它们存储在整数寄存器中,并将它们视为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

断爱 2024-08-10 01:59:18

首先,我希望您指的是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文