Going past the float size limits?

Hendrik van Rooyen mail at microcorp.co.za
Sat Oct 27 04:24:41 EDT 2007


<jimmy.musselwhite at gmail.com>  wrote:

> On Oct 26, 6:56 pm, "Chris Mellon" <arka... at gmail.com> wrote:

> > What in the world are you trying to count?
>
> The calculation looks like this
>
> A = 0.35
> T = 0.30
> C = 0.25
> G = 0.10
>
> and then I basically continually multiply those numbers together. I
> need to do it like 200,000+ times but that's nuts. I can't even do it
> 1000 times or the number rounds off to 0.0. I tried taking the inverse
> of these numbers as I go but then it just shoots up to "inf".

Yeah right.  Nuts it is.

0.35*0.3*0.25*0.1 is approximately a third of a third of a
quarter of a tenth, or more precisely 2.625 parts in a thousand.

So after the second set of mutiplies,  you have about 6.89 parts in a million,
and then 0.18 parts in a billion after the third, and so on - the exponent grows
by between -3 and -2 on every iteration.

So 0.002625**200000 is a number so small that its about as close as
you can practically get to bugger-all, as it is less than 10 ** -400000,
and more than 10**-600000

Now I have heard rumours that there are approximately 10**80 elementary
particles in the universe, so this is much less than one of them, even if my
rumour is grossly wrong.

A light year is of the order of 9.46*10**18 millimetres, and no human has ever
been that far away from home.  Call it 10**19 for convenience.  So your number
slices the last millimetre in a light year into more than 10**399981 parts.

Have you formulated the problem that you are trying to solve properly?

- Hendrik






More information about the Python-list mailing list