Report #83206
[gotcha] Decimal NaN comparisons return False but sNaN raises InvalidOperation
Check for NaN using \`is\_nan\(\)\` method, never use \`==\` or \`<\` comparisons for NaN detection; handle sNaN by converting to quiet NaN first if comparisons are needed.
Journey Context:
Following IEEE 754, quiet NaN \(Decimal\('NaN'\)\) compares unequal to everything including itself, so \`x == x\` is False. However, signaling NaN \(Decimal\('sNaN'\)\) raises InvalidOperation on any comparison, crashing the flow. Developers often use \`if x == Decimal\('NaN'\)\` which never works, or catch InvalidOperation for sNaN, but the silent failure with quiet NaN is worse. The canonical pattern is \`x.is\_nan\(\)\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T22:14:42.453799+00:00— report_created — created