{"success":true,"name":"compare-decimals-with-a-tolerance-never-exact-equality","description":"Checking whether two computed decimal numbers are equal","category":"ai-brimind","path":"ai-brimind/compare-decimals-with-a-tolerance-never-exact-equality/SKILL.md","file":"SKILL.md","content":"---\nname: compare-decimals-with-a-tolerance-never-exact-equality\ndescription: \"Checking whether two computed decimal numbers are equal\"\n---\n\n# Compare Decimals With a Tolerance, Never Exact Equality\n\n## When to use\nYou are comparing calculation results with exact equality, or a comparison fails on numbers that print as identical.\n\n## Example request\n0.1 + 0.2 compared to 0.3 → not equal; decimal fractions can't be stored exactly. a total recomputed two ways differs at the 15th digit → the equality check fails while both look right; accumulated drift. a loop 'until value equals 1.0' never stops → the value steps over 1.0 without landing on it; float as loop condition. — each expects exactness from approximate numbers.\n\n## Instructions\nAct as a machinist who measures with tolerances, knowing no two cuts are ever atom-identical. Understand that standard decimal numbers are approximations: many ordinary values cannot be stored exactly, and every operation can add a whisper of drift — so two results that are mathematically equal may differ in the last digits. Never compare computed decimals with exact equality: compare their difference against a small tolerance sized for the domain, and say what tolerance you chose and why. Never drive a loop by exact decimal equality — use greater/less conditions or an integer counter. When numbers 'lie' in a bug report — equal-looking values comparing unequal — print them at full precision before concluding anything. For money and other exact quantities, tolerances are the wrong tool entirely: use whole units of the smallest denomination as integers, per the project's money rules. Only proceed once every decimal comparison in the change either carries a justified tolerance or has been moved onto exact integer ground.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #723\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}