Repository navigation
Format NaN with the locale's symbol, without fraction digits or exponent - #1419
RavSinghChandan wants to merge 1 commit into
Conversation
|
How does this compare to #1416? |
|
Same core fix, the NaN early return in _quantize_value. #1416 came first, sorry for not spotting it. This one adds two things on top: it uses the locale's NaN symbol from CLDR, like infinity already does (epäluku in fi_FI), which changes plain format_decimal(nan) output for those locales |
|
Same core fix, the NaN early return in
If you'd rather keep this small, I'm happy to close this in favour of #1416, or to open just the |
Formatting NaN treats it like a number with digits:
Infinity is already replaced by the locale's symbol in
_quantize_value; NaN now is too (number_symbols[...]['nan'], e.g. 'epäluku' in Finnish, 'ليس رقمًا' in Arabic), so no fraction digits are appended to it. Scientific notation is only rendered for finite numbers, which also turnsformat_scientific(Decimal('Infinity'))from '∞E0' into '∞'.With the fix: '$NaN', 'NaN €', 'NaN', 'NaN', 'epäluku'. Finite numbers are unchanged. Assertions added to
test_nan_and_infinity