What is precision of a number representation? (was: Curious Omission In New-Style Formats)

Chris Angelico rosuav at gmail.com
Mon Jul 11 19:57:44 EDT 2016


On Tue, Jul 12, 2016 at 9:14 AM, Jan Coombs
<jenfhaomndgfwutc at murmic.plus.com> wrote:
> Thees all look good, but you may get into trouble if you trust a
> PC with them!
>
> If the language/PC uses floating point representation then it
> will assign a fixed number of bits for the fractional part, and
> this will be left aligned in all/most hardware.

PCs don't necessarily use floating point. Just check out Python's own
decimal.Decimal class, or roll your own if you need to.

ChrisA



More information about the Python-list mailing list