Blaise Delaney
Blaise Delaney

Reputation: 321

Python numpy type decimal places

I was wondering if there is a type in Numpy that allows numbers with around 20 decimal places, besides the type "decimal".

If not, do you have a suggestion to achieve the speed I would get performing calculations, say as when using floats?

Thanks,

Blaise

Upvotes: 1

Views: 920

Answers (1)

Jacob
Jacob

Reputation: 1553

mpmath at https://code.google.com/p/mpmath/

mpmath is a pure-Python library for multiprecision floating-point arithmetic. It provides an extensive set of transcendental functions, unlimited exponent sizes, complex numbers, interval arithmetic, numerical integration and differentiation, root-finding, linear algebra, and much more. Almost any calculation can be performed just as well at 10-digit or 1000-digit precision, and in many cases mpmath implements asymptotically fast algorithms that scale well for extremely high precision work. mpmath internally uses Python's builtin long integers by default, but automatically switches to GMP/MPIR for much faster high-precision arithmetic if gmpy is installed or if mpmath is imported from within Sage.

Upvotes: 1

Related Questions