"Todd Steury" <sciurus1 at iwon.com> writes: > or 1.#INDj. However I really need these numbers to be calculated (although > precision isn't key). Is there a way to get python to increase the size > limit of float and complex numbers? Python just uses machine doubles by default. You might be able to edit the source so it uses, say, 80-bit extended floats if you're on a machine that supports them (like the x86). Those do support larger exponents. You could also use something like gmpy, which supports arbitrary size and arbitrary precision numbers. Of course it's slow by comparison. > Since I learn best by example, how could one solve the following problem: > > from math import exp > >>>x=1000. > >>>z=exp(x) > > so that z returns an actual value You could rearrange your formulas to not need such big numbers: x = 1000. log10_z = x / math.log(10) c,m = divmod(log10_z, 1.) print 'z = %.5fE%d' % (10.**c, m)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4