On Oct 26, 6:29 pm, [EMAIL PROTECTED] wrote: > On Oct 26, 6:56 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > > On 10/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > Hello all > > > It would be great if I could make a number that can go beyond current > > > size limitations. Is there any sort of external library that can have > > > infinitely huge numbers? Way way way way beyond say 5x10^350 or > > > whatever it is? > > > > I'm hitting that "inf" boundary rather fast and I can't seem to work > > > around it. > > > 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".
As mentioned elsewhere, gmpy is a possible solution. You can do the calculations with unlimited precision rationals without introducing any rounding errors and then convert the final answer to unlimited precision floating point without ever hitting 0 or inf: >>> import gmpy >>> A = gmpy.mpq(35,100) >>> b = A**200000 >>> c = gmpy.mpf(b) >>> gmpy.fdigits(c) '4.06321735803245162316e-91187' -- http://mail.python.org/mailman/listinfo/python-list