下水浮点数是否总是四舍五入到零?

发布于 2025-02-07 15:56:47 字数 59 浏览 1 评论 0原文

假设最小的代表数为0.1。

根据IEEE 754,是否为0.09(下底流量)为0或0.1?

Assume the smallest representable number is 0.1.

Is 0.09, underflow, be rounded to 0 or 0.1 according to IEEE 754?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

阪姬 2025-02-14 15:56:47

如果您有一些假设的浮点格式,其中最小的代表正数为0.1,并且某些操作的实数算术结果(例如9除以100)为.09,那么计算的结果将由根据为操作选择的舍入规则,将.09舍入.09至0.1或0。

默认的舍入规则是循环到最新的。由于0.1接近0.09,而不是0,因此结果为0.1。

如果选择了非默认规则圆向折叠或圆形零件零,则结果为0。

If you had some hypothetical floating-point format in which the smallest representable positive number were 0.1, and the real-number-arithmetic result of some operation, such as 9 divided by 100, were .09, then the computed result would be determined by rounding .09 to either 0.1 or 0 according to the rounding rule chosen for the operation.

The default rounding rule is round-to-nearest-ties-to-even. Since 0.1 is nearer to .09 than 0 is, 0.1 would be the result.

If the non-default rule round-downward or round-toward-zero had been chosen, the result would be 0.

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