克劳德代码介绍了一类越界错误。
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(一个编码助手)存在的一些问题。用户报告的错误范围从令人恼火的 UI 缺陷(例如每次按键都进行全屏重绘和持续的反馈请求)到大整数精度的一个显著错误。 具体来说,由于 JavaScript 数字表示的限制(特别是浮点精度),Claude Code 会错误地显示超过 15 位小数的数字。例如,数字 `348555896224571969` 经常被渲染为 `348555896224571970`。 虽然针对显示问题的修复已经合并,但人们仍然担心其底层架构。问题源于使用 JSON 进行组件间的数据传输,这导致了精度损失。用户担心这个问题可能在系统的其他领域悄无声息地发生。 讨论还指出了潜在的解决方法,例如使用替代的 CLI 或 IDE 集成,并强调了调试 LLM 驱动工具的挑战,因为问题可能难以快速诊断和修复。
相关文章

原文

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