Discussion:
Biggest float number?
Paul Barrett
2001-03-28 14:11:09 UTC
Permalink
2.**1024 - 1.
which is about 1.8E308. Is there any way to get bigger value than this,
just like long intergers almost have no limits?
Try using a log()-based algorithm, i.e. instead of multiplying two large
numbers together, take their log() and add them.

This approach has always worked for me, since I've found that precision
is usually less of an issue than range, when dealing with such large
numbers.
--
Dr. Paul Barrett Space Telescope Science Institute
Phone: 410-338-4475 ESS/Science Software Group
FAX: 410-338-4767 Baltimore, MD 21218
Pearu Peterson
2001-03-27 06:09:04 UTC
Permalink
Hi all,
2.**1024 - 1.
which is about 1.8E308. Is there any way to get bigger value than this,
just like long intergers almost have no limits?
Try GMPY

http://gmpy.sourceforge.net/

For example,
from gmpy import mpf
mpf('1e2000000000')
mpf('1.e2000000000')
mpf('1.1e200000000')+mpf('3.1e200000000')
mpf('4.2e200000000')

Regards,
Pearu
C. S. Xu
2001-03-26 21:58:32 UTC
Permalink
Hi all,

It seems the biggest floating number in Python can be:
2.**1024 - 1.
which is about 1.8E308. Is there any way to get bigger value than this,
just like long intergers almost have no limits?

Thanks in advance for any replies.

xcs
Moshe Zadka
2001-03-26 22:56:38 UTC
Permalink
2.**1024 - 1.
which is about 1.8E308. Is there any way to get bigger value than this,
just like long intergers almost have no limits?
<shameless promotion>
you can try my Rational numbers module at http://moshez.org/Rational.py.
It's for rationals, not floats, but it does support non-integers to
unbounded precision and size.
</shameless promotion>
--
"I'll be ex-DPL soon anyway so I'm |LUKE: Is Perl better than Python?
looking for someplace else to grab power."|YODA: No...no... no. Quicker,
-- Wichert Akkerman (on debian-private)| easier, more seductive.
For public key, finger moshez at debian.org |http://www.{python,debian,gnu}.org
Joshua Marshall
2001-03-26 22:19:22 UTC
Permalink
Hi all,
2.**1024 - 1.
which is about 1.8E308. Is there any way to get bigger value than this,
just like long intergers almost have no limits?
One possible workaround is to use a pair of long ints as numerator and
denominator of a rational number.

Loading...