JavaScript number precision loss
An AI assistant generated this TypeScript serializer for a payments API response. The API consumer (a mobile app) starts showing wrong amounts and dropped metadata after a release, but only for some transactions.
What correctness problems would you flag before this ships, given amounts can be large and `amountMinor` is a 64-bit integer string?
Implement
format_minor_units(amounts_minor: list[str], exponent: int) → list[str]Examples
in
[["1999","100","9007199254740993"],2]out["19.99","1.00","90071992547409.93"]in
[["5","-250","0"],2]out["0.05","-2.50","0.00"]in
[["1500",""],0]out["1500","invalid"]What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
0:00 of about 14 min
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.