Sorry if I missed this, but I didn't see a description in the PEP of how Decimal numbers would convert to other types. If d is a Decimal number, I assume int(d) is obvious and float(d) does the best it can with double precision, right? How about str(d)? I would hope that it uses exponential notation only when necessary to preserve the number of significant digits. Could we please have repr(d) use the string in the constructor rather than the tuple form? That would be much easier to read. So, for example: >>> Decimal('12345') Decimal('12345') # instead of Decimal((0, (1, 2, 3, 4, 5, 0)) >>> _ * 10 Decimal('1.2345e1') >>> Decimal('12345', 2) Decimal('1.2e3') >>> Decimal(1.1) Decimal('1.100000000000000088817841970012523233890533447265625') >>> Decimal(1.1, default_context=1) Decimal('1.10000000') -- ?!ng
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4