Report #6564
[gotcha] Decimal\(float\) constructor produces unexpected precision artifacts
Always pass numeric strings or tuples to Decimal\(\), never floats; use Decimal\(str\(my\_float\)\) only if unavoidable, understanding the binary representation loss
Journey Context:
Floats are binary approximations; Decimal\(0.1\) captures the exact binary float 0.1 \(which is 0.100000000000000005551...\), not the decimal 0.1. Using strings ensures the Decimal represents the decimal number intended. This is critical for financial calculations where 0.1 must be exact.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T00:21:23.692225+00:00— report_created — created