Double precision floating values in Python?


Are there data types with better precision than float?

3/12/2017 12:06:00 PM

Accepted Answer

Decimal datatype

  • Unlike hardware based binary floating point, the decimal module has a user alterable precision (defaulting to 28 places) which can be as large as needed for a given problem.

If you are pressed by performance issuses, have a look at GMPY

7/12/2011 11:11:25 AM

Python's built-in float type has double precision (it's a C double in CPython, a Java double in Jython). If you need more precision, get NumPy and use its numpy.float128.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow