下水浮点数是否总是四舍五入到零?
假设最小的代表数为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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有一些假设的浮点格式,其中最小的代表正数为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.