Splitting numeric litterals

bart.c bartc at freeuk.com
Fri Jul 16 13:30:38 EDT 2010


"Steven D'Aprano" <steve at REMOVE-THIS-cybersource.com.au> wrote in message 
news:4c4069de$0$11101$c3e8da3 at news.astraweb.com...
> On Fri, 16 Jul 2010 14:49:21 +0100, MRAB wrote:

> Not only that, but it only takes 73 digits to write out the total number
> of particles in the entire universe:
>
> 1000000000000000000000000000000000000000000000000000000000000000000000000
>
> or 1e72. (Of course that's the lower-bound, estimates range from 1e72 all
> the way up to 1e87.)
> So for anything related to counting or labelling
> actual, physical objects, you will be dealing with smaller numbers than
> that. E.g. the number of grains of sand on the earth has been estimated
> (very roughly) as a mere 1000000000000000000000000, or 25 digits.

Big integers tend to be used for playing around with mathematical ideas, and 
they have to be exact. So if you wanted to hardcode 1000! for some reason, 
you'd need some 2568 digits which is a little awkward on one line.

> It always makes me laugh when I receive an invoice from some company, and
> the account number or invoice number is (e.g.) 1000000023456789. Who do
> they think they're fooling?

I used to do that. Giving someone an invoice number, or product serial 
number, 000001 doesn't exactly give the impression of a thriving business.

-- 
Bartc 




More information about the Python-list mailing list