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.
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.
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
How do you deal with the annoying float precision problem?
you could always round(x, 5) it to like 5 sigfigs. if you desperately need high precision, use the decimal module.
edit: oh yeah you can use float.is_integer() to check if the mantissa is zero or not. handy with round!
Double precision
gRPC implementation's float precision
Best way to store an 4800 double precision type array in PostgreSQL?
Videos
Hi everyone!
I recently started a project with Python and after long weeks of writing code, I saw that Python's default float precision is just not enough for my needs.
Is there a simple way to change the default Python precision without having to rewrite all my code?
Thank you all in advance!