Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 13 years ago

Volker Braun gravatar image

Python floating point numbers are limited in their mantissa, this is why float(2.23799235765712699e47675) is inf. Since python doesn't have arbitrary precision floating point numbers, you can't use python string formatting to achieve what you want. You can, however, write your own printing routine for arbitrary precision (MPFR) reals.

click to hide/show revision 2
No.2 Revision

Python floating point numbers are limited in their mantissa, exponent, this is why float(2.23799235765712699e47675) is inf. Since python doesn't have arbitrary precision floating point numbers, you can't use python string formatting to achieve what you want. You can, however, write your own printing routine for arbitrary precision (MPFR) reals.