[Python-ideas] numerical type combining integer and float/decimal properties [Was: Re: Python Numbers as Human Concept Decimal System]

Chris Angelico rosuav at gmail.com
Mon Mar 10 23:29:26 CET 2014


On Tue, Mar 11, 2014 at 8:57 AM, Guido van Rossum <guido at python.org> wrote:
> It looks neither plausible nor tempting to me at all, and I hope that's not
> what he meant. It can represent numbers of any magnitude that have lots of
> zeros following the decimal point followed by up to 16 digits of precision,
> but not numbers that have e.g. lots of ones instead of those zeros -- the
> float portion would be used up for the first 16 ones. E.g.
>
> 111111111111111111111111111111.000000000000000000000000000000123456789
>
> would be representable exactly but not
>
> 111111111111111111111111111111.111111111111111111111111111111123456789
>
> What makes numbers in the vicinity of integers special?

Hmm, good point. I was thinking this would give a predictable 16
digits of precision after the decimal, but the leading zeroes are
somewhat special. But when I said "tempting" I meant that it looks
initially nice, and then went on to show that it's not so nice on
analysis - which latter part you're also demonstrating.

ChrisA


More information about the Python-ideas mailing list