If you need to handle numbers which are very large or very small and outside the range of the python double precision type then you can use the Python cdecimal module. The documentation is same as the Python standard library decimal module but the cdecimal module is implemented in C so it is faster. In Python 2.7 cdecimal is written in C and decimal is written in Python. In Python 3.3 and later, decimal is written in C so just use decimal instead of cdecimal.
(Alternative modules are mpmath, gmpy2, bigfloat.)
import cdecimal as cd
Note about numpy.longdouble and numpy.float128:
numpy.longdouble and numpy.float128 have same range as double precision.
They cannot handle very large or very small numbers.
>>> import numpy