Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Text, time and money: classic data traps card 4 of 6

A 'fix' that keeps the float

builds on: Why agents fill gaps with plausible guesses
You report totals that are a cent off. The agent replies: 'Switched to BigDecimal; rounding is now exact.' The diff has `new BigDecimal(item.getPrice())`, but `getPrice()` still returns `double`. The tell is the type where the price enters the code, not the class name: `new BigDecimal(0.1)` is exactly 0.1000000000000000055511…. Later cost: half-cent ties still round wrong. `new BigDecimal(1.015)` is just below 1.015, so it rounds to 1.01, not 1.02, and the bug now hides behind a reassuring type. BETTER: read the price as text or SQL DECIMAL into `new BigDecimal("19.99")`, keep it `BigDecimal` throughout, and round once with `setScale(2, RoundingMode.HALF_EVEN)`.
Terms on this card
tell
An observable sign in a diff, transcript or summary that suggests a shortcut or an error.
later cost
The concrete damage a shortcut does after merge: a hidden bug, silent data corruption or a maintenance burden.
diff
The change under review in unified format: '-' lines are removed, '+' lines are added, and unprefixed lines are context.
Decimal
Python's base-10 number type (decimal module). It is exact for values like 0.10 when built from strings, not from floats.
BigDecimal
Java's arbitrary-precision base-10 number type for money. Build it from a String; a double carries in binary error.
Learn this step by step on Bytewise
Lesson goal: Spot agent code that is wrong for real-world data: string length, slicing or case-folding that breaks on non-ASCII text, naive datetimes and DST or time-zone shifts, and floating-point arithmetic for money. Name the safe type or library in each language (for example Decimal or BigDecimal, integer cents, zone-aware datetimes). · the whole lesson