Explain it in 60 seconds
Float vs Decimal for money
Data Engineering · Python · Experienced
Why shouldn't you use float for money in Python, and what do you use instead?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Floats are binary approximations, so 0.1 + 0.2 isn't exactly 0.3.
- Rounding errors add up in financial totals.
- Use decimal.Decimal for exact decimal math.
- Or store money as integer minor units like cents or paise.
- Keep precision consistent with the warehouse NUMBER type.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.