PI Was Set to 3.1415: Claude Reviewed His 2013 Math Internship Code and Cut a Simulation's Drift 750 Times
- Level Advanced
- Setup1–3 hrs (estimated)
- Evidence Strong evidence
- CostNot stated in source
- No-codeNo
What they did
In 2013, as a math intern, he wrote C code for a shallow-water equations scheme. This week he pointed Claude at the repo for a review. It found PI defined as 3.1415, which made a lake that should stay still slowly move; fixing it cut the drift 750 times. It also found an error norm multiplied by dx that hid errors by a factor of 50, and a sign typo in one of the paper's integrals. A better quadrature rule fixed the remaining drift and made the run 20 times faster.
How it went
Hidden numeric bugs found, with drift cut 750 times and the run made 20 times faster.
Worth knowing
- Hacker News post by MathLab (Oct 23, 2026 Denver time): Claude reviewed his 2013 C code and found PI=3.1415 (fixing it cut drift 750x), an error norm that hid errors 50x, and a sign typo in the paper; a tanh-sinh rule made it 20x faster.
- Have the agent prove each fix with a test case; 'it found a bug' isn't enough for research code.
Prompt
Cleaned version rewritten from the source — not a direct quote.
Review this scientific code ([repo]) against the method in [paper]. Check constants, units, numerical integration and error measures. Check that the code's equations match the paper, and flag where the paper itself may be wrong. For each finding, give a test that shows the effect before and after the fix. Don't change the code until I approve.
Recommended
Try it in Grok Bot
Grok Bot can run a review like this through a coding agent and summarize the findings.
- Copy the prompt (button below).
- Open Grok Bot chat and paste it. Replace any [bracketed] placeholders.
- Connect the listed tools (as needed) as connectors when Grok Bot asks.
- If the task repeats, ask: "Make this a daily routine."
Alternatives: the same prompt works in Claude, ChatGPT Agent, OpenClaw.
Set it up
Stack: Claude + code repo
- Read the original source for full context.
- Connect the tools your agent needs.
- Paste the prompt and replace [bracketed] placeholders.
- Run once manually and check the output before scheduling it.
Generic suggested steps, not from the source.
Evidence
Hacker News post by MathLab (Oct 23, 2026 Denver time): Claude reviewed his 2013 C code and found PI=3.1415 (fixing it cut drift 750x), an error norm that hid errors 50x, and a sign typo in the paper; a tanh-sinh rule made it 20x faster. Have the agent prove each fix with a test case; 'it found a bug' isn't enough for research code
Source: HN · 2026-10-23 · Verified by us: not yet · Report broken or outdated