So mnan compares to nan the same as nan2 compares to nan. From this perspective it seems like Decimal("-nan") behaves exactly like Decimal("-nan")except for the __repr__ which includes the minus sign for Decimal("-nan").
Does Decimal("-nan") matter? I have a number formatting library and I’m wondering if it could ever matter that I preserve the minus sign on Decimal("-nan"). I know nan is defined in some technical specifications. Is -nan specified?
Note that
print(float("-nan"))
# nan
So for floats the -nan seems to be cast to just nan.
At least in IEEE 754 (which, for most purposes, is the only floating-point format you need to worry about), there is an entire family of NaN values. They are distinguished by have all of the exponent bits set to 1, and at least one fraction bit set to 1. (All-1 exponent and all-0 fraction is infinity.) So half of all NaNs are “positive” (sign bit 0), and the other half are “negative” (sign bit 1). Things like float("nan") and float("-nan") return a particular representative signed NaN.