错误报告:舍入问题

中本聪SN-1363

一定是 getinfo 转成浮点数返回 JSON-RPC 结果时的舍入误差。唯一用浮点数表示钱的地方就是返回 JSON-RPC 值。

It must be a rounding error when getinfo converts to floating point to return the JSON-RPC result. The only place where it uses floating point to represent money is returning a value in JSON-RPC.

1.139999999999 的小数位数超出了 bitcoin 内部能表示的精度。

1.139999999999 is longer than bitcoin can internally represent.

内部只可能是:

internally, it could only be:

1.13999999 或

1.13999999 or

1.14000000

1.14000000

1.139999999999 离 1.14000000 比离 1.13999999 近得多,所以一定是 1.14000000。

1.139999999999 is much much closer to 1.14000000 than 1.13999999, so it must be 1.14000000.

代码是这样的:

The code is this:

(double)GetBalance() / (double)COIN.

(double)GetBalance() / (double)COIN.

(一时想不出简单的修法)

(I can't think of an easy way to fix it at the moment)

上下文
译文校对、修订与纠错

当前版本尚未建立逐条校对状态记录。来源核验、历史审校与当前译文校对是不同事项。

查看历史审校与代表修订 →

译文内容版本:dcb57d38dd5b。用于比对文本,不代表校对等级或更新时间。

准备纠错说明

请填写对应原文、现译文、建议译法和理由。复制后通过你联系本站作者的渠道提交;此处不会自动发送。

来源
英文原标题

BUG Report: Rounding glitch

Bitcointalk · 原始链接 ↗ 记录编号 SN-1363

阅读字号

选择适合你的字号,之后阅读会继续使用。