Float literal compared with equality operator
Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 4 points from that category, once per scan, no matter how many places it turns up.
What it detects
Floating-point arithmetic cannot represent most decimal fractions exactly, so comparing a computed float to a literal with ==/!= can be false even when the values are conceptually equal.
Why it matters
Floating-point arithmetic cannot represent most decimal fractions exactly, so a computed value that is conceptually 0.1 might actually be stored as 0.10000000000000001, and comparing it to the literal 0.1 with == can silently evaluate to False even though the values are 'the same' for any practical purpose. This shows up as flaky, hard-to-reproduce bugs that depend on exactly how a value was computed rather than what it conceptually equals.
How to fix it
Compare with a tolerance instead of exact equality, for example abs(a - b) < 1e-9, or use math.isclose(a, b), which handles both relative and absolute tolerance correctly. If the value is actually a currency amount, consider using Decimal or integer cents instead of float entirely.
The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing
Does your repo trip this check?
Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.
Scan your repo