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.

Answer from Fred Foo on Stack Overflow
🌐
AskPython
askpython.com › home › double precision floating values in python
Double precision floating values in Python - AskPython
April 10, 2025 - Luckily, Python offers some great options for working with high-precision decimal values. Python’s standard float type, based on double-precision IEEE 754 format, provides up to 15 decimal digits of precision.
Discussions

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!

More on reddit.com
🌐 r/learnpython
6
1
June 12, 2017
Double precision
All Python floats are double precision by default. If you need even more precision, you have to use decimal or something. More on reddit.com
🌐 r/Python
16
1
October 17, 2019
gRPC implementation's float precision
Ruby’s float implementation is actual a double: https://ruby-doc.org/core-2.5.0/Float.html Perhaps the difference is the Coercion from protobuf float to ruby “float” More on reddit.com
🌐 r/ruby
3
7
May 10, 2020
Best way to store an 4800 double precision type array in PostgreSQL?
Hmm, I think an array column could be okay here. I don't see why building that SQL would take a significant amount of time and you definitely don't need to worry about maximum number of columns when you have just one array column. More on reddit.com
🌐 r/PostgreSQL
6
0
August 3, 2016
🌐
Reddit
reddit.com › r/python › double precision
r/Python on Reddit: Double precision
October 17, 2019 -

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!

🌐
eSparkBiz
esparkinfo.com › double precision floating values
How to Use Double Precision Floating Values in Python
September 2, 2025 - Understand how Python supports Double Precision Floating Values, decimal and fractions modules to perform accurate, high-precision math operations easily.
Price   $12
Address   1001 - 1009 10th floor City Center 2, Sukan Mall Cross Road, Science City Rd, 380060, Ahmedabad
🌐
Python documentation
docs.python.org › 3 › tutorial › floatingpoint.html
15. Floating-Point Arithmetic: Issues and Limitations — Python 3.14.3 documentation
Why is that? 1/10 is not exactly representable as a binary fraction. Since at least 2000, almost all machines use IEEE 754 binary floating-point arithmetic, and almost all platforms map Python floats to IEEE 754 binary64 “double precision” values.
🌐
Bacancy Technology
bacancytechnology.com › qanda › python › double-precision-floating-values-in-python
How to Use Double Precision Floating Values in Python
June 24, 2025 - from decimal import Decimal, getcontext getcontext().prec = 30 # Set desired precision x = Decimal('0.123456789012345678901234567890') print(x) ... This retains mathematical accuracy without floating-point rounding errors. ... Work with our skilled Python developers to accelerate your project and boost its performance.
🌐
ZetCode
zetcode.com › python › decimal
Python Decimal - high-precision calculations in Python with Decimal
In the following example, we also use the mpmath module, which is a library for arbitrary-precision floating-point arithmetic. ... We need to install mpmath first. ... #!/usr/bin/python from decimal import Decimal, getcontext import math import mpmath getcontext().prec = 50 mpmath.mp.dps = 50 num = Decimal(1) / Decimal(7) num2 = mpmath.mpf(1) / mpmath.mpf(7) print(" math.sqrt: {0}".format(Decimal(math.sqrt(num)))) print("decimal.sqrt: {0}".format(num.sqrt())) print(" mpmath.sqrt: {0}".format(mpmath.sqrt(num2))) print('actual value: 0.3779644730092272272145165362341800608157513118689214')
Find elsewhere
🌐
Mathspp
mathspp.com › blog › til › precision-of-python-floats
TIL #053 – precision of Python floats | mathspp
Python floats are IEEE 754 double-precision binary floating-point numbers, commonly referred to as “doubles”, and take up 64 bits.
🌐
GitHub
github.com › milvus-io › milvus › discussions › 20870
Double-precision to single-precision float conversions in pymilvus package · milvus-io/milvus · Discussion #20870
@yhmo What I am saying is that calling Python's round(x, 6) is not the same as converting a 64-bit IEEE double to a 32-bit float! For example, Python's round(x, 6) would convert 0.0000001 to exactly 0.0, whereas, using the C/C++ notation, (float)0.0000001 (or 1.0e-7f) is still > 0.0 and can be represented by a 32-bit float just fine. You are confusing the 'positions after the decimal point' with the precision.
Author   milvus-io
🌐
Appdividend
appdividend.com › python-double
Double (Float) Data Type in Python
December 13, 2025 - Python does not have a built-in double data type, but it does have a float type, which designates a floating-point number. It handles double precision by default, adhering to the IEEE 754 standard.
🌐
Squash
squash.io › how-to-use-double-precision-floating-values-in-python
How to Use Double Precision Floating Values in Python
November 2, 2023 - In this example, we compare two double precision floating values, value1 and value2, using both math.isclose and a tolerance value. The rel_tol parameter in math.isclose specifies the relative tolerance, which is the maximum allowed difference between the two values. Related Article: How to Check If Something Is Not In A Python List
🌐
Python Reference
python-reference.readthedocs.io › en › latest › docs › float
float — Python Reference (The Right Way) 0.1 documentation
These represent machine-level double precision floating point numbers. You are at the mercy of the underlying machine architecture (and C or Java implementation) for the accepted range and handling of overflow. Python does not support single-precision floating point numbers; the savings in ...
🌐
Note.nkmk.me
note.nkmk.me › home › python
Maximum and Minimum float Values in Python | note.nkmk.me
August 11, 2023 - In Python, the float type is a 64-bit double-precision floating-point number, equivalent to double in languages like C. This article explains how to get and check the range (maximum and minimum values ...
🌐
EyeHunts
tutorial.eyehunts.com › home › python double precision
Python double precision - Tutorial - By EyeHunts
February 27, 2023 - 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. Simple example code double length binary representation of variable compared to the binary representation of float. from decimal import Decimal d = Decimal(2.675) print(d) print(type(d)) print(float(d)) print(type(float(d))) ... Comment if you have any doubts or suggestions on this Python precision topic.
🌐
Quora
quora.com › What-exactly-is-the-difference-between-decimals-floating-point-numbers-and-doubles-in-Python-programming-They-seem-to-get-addressed-interchangeably
What exactly is the difference between decimals, floating-point numbers and doubles in Python programming? They seem to get addressed interchangeably. - Quora
Answer (1 of 3): There is no such thing as doubles in Python itself, but Internally a floating point value is stored in a double precision C floating point value (as defined by IEEE 754 [1]) Floating point values are limited precision - they ...
🌐
Mpmath
mpmath.org › doc › current › technical.html
Precision and representation issues — mpmath 1.3.0 documentation
On most systems, Python’s float type represents an IEEE 754 double precision number, with a precision of 53 bits and rounding-to-nearest. With default precision (mp.prec = 53), the mpmath mpf type roughly emulates the behavior of the float type.
🌐
Uchicago
geosci.uchicago.edu › ~rtp1 › itr › PythonLectures › DoubleGotcha.html
Promotion of Numeric arrays to double
For operations involving arrays alone, the behavior is usually what one would anticipate, but some surprising behavior results from the fact that Python floating point variables are always double precision. There is no single precision Python type. >>> x = Numeric.zeros(5,Numeric.Float32) >>> ...
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › hardware and peripherals › raspberry pi pico › micropython
MicroPython double precision - Raspberry Pi Forums
Floating point format test 14.39272672286573 14.4 -> 14.4 14.39 -> 14.39 14.393 -> 14.393 14.3927 -> 14.3927 14.39273 -> 14.39273 14.392727 -> 14.392727 14.3927267 -> 14.3927267 14.39272672 -> 14.39272672 14.392726723 -> 14.392726723 14.3927267229 -> 14.3927267229 14.39272672287 -> 14.39272672287 14.392726722866 -> 14.392726722866 14.3927267228657 -> 14.3927267228657 14.39272672286572 -> 14.39272672286573 <-- Diverges here (double) 14.392726722865724 -> 14.392726722865725 Floating point kahan test ... please wait - takes about 80 seconds 14.39272672286573 14.392726722865724 -> 14.392726722865725 Total elapsed time 76.64488 seconds The time penalty for going to double doesn't seem that bad here. ... Mon Sep 13, 2021 3:53 pm Funnily enough I had noticed your comment about MicroPython only being single precision in the BBC Basic thread.
🌐
Codefinity
codefinity.com › blog › Float-vs-Double
Float vs Double
my_float = 3.14 # Python uses 64-bit IEEE 754 double precision by default