克劳德代码介绍了一类越界错误。
Large integer precision error in Bash command output rendering

原始链接: https://github.com/anthropics/claude-code/issues/11506

Claude Code 在 bash 命令输出中错误显示大整数,显示的值与命令实际输出的值不同。 重现步骤: 在 Claude Code 中运行以下命令:echo '348555896224571969' 或者使用 jq:echo '{"value": 348555896224571969}' | jq -c .value 预期行为: Claude Code 应显示:348555896224571969 实际行为: Claude Code 显示:348555896224571970 (差 1) 验证: 在原生终端中运行相同的命令可以正确输出:348555896224571969 环境: Claude Code 版本:v2.0.37 模型:Sonnet 4.5 (Claude Max) 平台:macOS (Darwin 24.3.0) 截图

## Claude Code 与大整数精度问题 一篇 Hacker News 讨论指出,Anthropic 的 Claude Code 在处理 Bash 命令中的大整数时存在精度错误。用户发现,回显数字 `348555896224571969` 的结果是 `348555896224571970`。 根本原因似乎在于 Claude Code 的后端使用了 JavaScript 数字处理,这受到浮点精度限制的影响。这个问题并非 Claude Code 独有;在浏览器开发者控制台和 Python 中也观察到类似的行为。Claude Code 的架构——用 Python 封装 Bash——以及低效的 UI 行为,例如在每次按键时重新绘制整个对话历史记录(尤其是在通过 SSH 时)加剧了这个问题。 虽然一些用户认为 Claude Code 即使存在这些缺陷仍然有用,但另一些人则将其视为“感觉编程”和质量控制不足的例子。这个错误凸显了将大型语言模型与现有工具集成以及处理数值精度时可能出现意外行为的挑战。
相关文章

原文

Claude Code incorrectly displays large integers in bash command output, showing a different value than what was actually output by the command.

Steps to Reproduce

  1. Run the following command in Claude Code:
echo '348555896224571969'

Or with jq:

echo '{"value": 348555896224571969}' | jq -c .value

Expected Behavior

Claude Code should display: 348555896224571969

Actual Behavior

Claude Code displays: 348555896224571970 (off by 1)

Verification

Running the same command in a native terminal correctly outputs: 348555896224571969

Environment

  • Claude Code version: v2.0.37
  • Model: Sonnet 4.5 (Claude Max)
  • Platform: macOS (Darwin 24.3.0)

Screenshots

Image

联系我们 contact @ memedata.com