Report #15713
[gotcha] Decimal constructed from float loses precision silently
Always construct Decimal from string \`Decimal\('0.1'\)\` not float \`Decimal\(0.1\)\`; if converting existing floats, use \`Decimal\(str\(value\)\)\` or \`Decimal.from\_float\(\)\` with explicit context
Journey Context:
Developers often assume \`Decimal\` is a magic 'precise math' wrapper around floats, but \`Decimal\(0.1\)\` first converts the float 0.1 to its exact binary representation \(with 53 bits of precision\), then creates a Decimal of that approximation. This creates a Decimal with many digits that is not the decimal '0.1' the user intended. The fix is string construction which parses the decimal representation directly, bypassing float binary errors entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:49:52.816865+00:00— report_created — created