>>> numpy.float64(5.9975).hex()
'0x1.7fd70a3d70a3dp+2'
>>> (5.9975).hex()
'0x1.7fd70a3d70a3dp+2'

They are the same number. What differs is the textual representation obtained via by their __repr__ method; the native Python type outputs the minimal digits needed to uniquely distinguish values, while NumPy code before version 1.14.0, released in 2018 didn't try to minimise the number of digits output.

Answer from Ignacio Vazquez-Abrams on Stack Overflow
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ user โ€บ basics.types.html
Data types โ€” NumPy v2.4 Manual
There are 5 basic numerical types ... type. The bitsize is the number of bits that are needed to represent a single value in memory. For example, numpy.float64 is a 64 bit floating point data type....
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ numpy โ€บ python-numpy
Python NumPy - GeeksforGeeks
import numpy as np x = np.array([1, 2]) print(x.dtype) x = np.array([1.0, 2.0]) print(x.dtype) x = np.array([1, 2], dtype = np.int64) print(x.dtype) Output ยท int64 float64 int64 ยท In Numpy arrays, basic mathematical operations are performed element-wise on the array.
Published ย  1 week ago
Discussions

Numpy float64 vs Python float - Stack Overflow
Numpy float64 dtype inherits from Python float, which implements C double internally. More on stackoverflow.com
๐ŸŒ stackoverflow.com
failure to convert numpy.float64 into System.Double
Environment Pythonnet version: 3.0 Python version: 3.x Operating System: Windows/Linux .NET Runtime: x Details Passing in a numpy array to a C# function that takes a double[] parameter fails. pytho... More on github.com
๐ŸŒ github.com
24
September 12, 2022
Preventing numpy from converting float type to numpy.int64 type
Numpy arrays have a defined data type. eta_hat is an array of dtype int64, because that's how you initialized it in the first place: as the docs say, if no type is given explicitly then "the type will be determined as the minimum type required to hold the objects in the sequence". So the solution is to explicitly make it an array of floats: eta_hat = numpy.array( [ [0], [0], [0] ], dtype=float) More on reddit.com
๐ŸŒ r/learnpython
3
1
April 3, 2023
Should I use numpy.float64 instead of Python float when also using numpy.array - Stack Overflow
I have not encountered any problems thus far, so this is a question purely out of curiosity. In Python I usually define floats and arrays of floats like this: import numpy as np s = 1.0 v = np.a... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Medium
medium.com โ€บ @amit25173 โ€บ understanding-numpy-float64-a300ac9e096a
Understanding numpy.float64. If you think you need to spend $2,000โ€ฆ | by Amit Yadav | Medium
February 8, 2025 - The main difference lies in precision. float64 uses 64 bits, offering more precision (about 15โ€“17 decimal places) than float32, which uses only 32 bits and is limited to around 7 decimal places.
๐ŸŒ
YouTube
youtube.com โ€บ codetube
Convert list of numpy float64 to float in Python quickly - YouTube
In Python, you might need to convert a list of numpy.float64 elements to regular Python float type for various purposes. This tutorial will guide you through...
Published ย  November 4, 2023
Views ย  73
Top answer
1 of 2
69
>>> numpy.float64(5.9975).hex()
'0x1.7fd70a3d70a3dp+2'
>>> (5.9975).hex()
'0x1.7fd70a3d70a3dp+2'

They are the same number. What differs is the textual representation obtained via by their __repr__ method; the native Python type outputs the minimal digits needed to uniquely distinguish values, while NumPy code before version 1.14.0, released in 2018 didn't try to minimise the number of digits output.

2 of 2
3

Numpy float64 dtype inherits from Python float, which implements C double internally. You can verify that as follows:

isinstance(np.float64(5.9975), float)   # True

So even if their string representation is different, the values they store are the same.

On the other hand, np.float32 implements C float (which has no analog in pure Python) and no numpy int dtype (np.int32, np.int64 etc.) inherits from Python int because in Python 3 int is unbounded:

isinstance(np.float32(5.9975), float)   # False
isinstance(np.int32(1), int)            # False

So why define np.float64 at all?

np.float64 defines most of the attributes and methods in np.ndarray. From the following code, you can see that np.float64 implements all but 4 methods of np.array:

[m for m in set(dir(np.array([]))) - set(dir(np.float64())) if not m.startswith("_")]

# ['argpartition', 'ctypes', 'partition', 'dot']

So if you have a function that expects to use ndarray methods, you can pass np.float64 to it while float doesn't give you the same.

For example:

def my_cool_function(x):
    return x.sum()

my_cool_function(np.array([1.5, 2]))   # <--- OK
my_cool_function(np.float64(5.9975))   # <--- OK
my_cool_function(5.9975)               # <--- AttributeError
Find elsewhere
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ numpy โ€บ numpy_data_types.asp
NumPy Data Types
NumPy HOME NumPy Intro NumPy Getting Started NumPy Creating Arrays NumPy Array Indexing NumPy Array Slicing NumPy Data Types NumPy Copy vs View NumPy Array Shape NumPy Array Reshape NumPy Array Iterating NumPy Array Join NumPy Array Split NumPy Array Search NumPy Array Sort NumPy Array Filter
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ library โ€บ functions.html
Built-in Functions โ€” Python 3.14.4 documentation
February 27, 2026 - These read-only attributes are set to the argument values (or their default). They have no other explicit functionality; however, they are used by NumPy and other third-party packages.
๐ŸŒ
GitHub
github.com โ€บ pythonnet โ€บ pythonnet โ€บ issues โ€บ 1936
failure to convert numpy.float64 into System.Double ยท Issue #1936 ยท pythonnet/pythonnet
September 12, 2022 - This will convert any type that is derived from PyFloatType, which includes numpy.float64
Author ย  rzindler
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ preventing numpy from converting float type to numpy.int64 type
r/learnpython on Reddit: Preventing numpy from converting float type to numpy.int64 type
April 3, 2023 -

So I have 3-tuple of only float types, let's call it eta.

I also have a class attribute eta_hat which is initialized as numpy.array( [ [0], [0], [0] ] ), the idea it being a column vector.

My goal is to make the values of eta_hat the values of eta. However, the piece of code

self.eta_hat[0][0], self.eta_hat[1][0], self.eta_hat[2][0] = eta[0], eta[1], eta[2]

converts eta[x] from float to numpy.int64 in self.eta_hat[x][0]. I do not understand how numpy handles these, and would love an explenation on how I could fix this problem. Thanks!

๐ŸŒ
Polars
docs.pola.rs โ€บ py-polars โ€บ html โ€บ reference โ€บ api โ€บ polars.concat.html
polars.concat โ€” Polars documentation
Combine multiple DataFrames, LazyFrames, or Series into a single object ยท DataFrames, LazyFrames, or Series to concatenate
๐ŸŒ
NumPy
numpy.org โ€บ devdocs โ€บ user โ€บ basics.types.html
Data types โ€” NumPy v2.5.dev0 Manual
There are 5 basic numerical types ... type. The bitsize is the number of bits that are needed to represent a single value in memory. For example, numpy.float64 is a 64 bit floating point data type....
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.3 โ€บ reference โ€บ arrays.scalars.html
Scalars โ€” NumPy v2.3 Manual
numpy.float64: 64-bit precision floating-point number type: sign bit, 11 bits exponent, 52 bits mantissa.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_casting.asp
Python Casting
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST TOOLS
๐ŸŒ
Audio Science Review
audiosciencereview.com โ€บ forums
Audio Science Review (ASR) Forum
February 17, 2026 - Audio reviews, science and engineering discussions.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 1.22 โ€บ user โ€บ basics.types.html
Data types โ€” NumPy v1.22 Manual
>>> np.power(100, 100, dtype=np.int64) # Incorrect even with 64-bit int 0 >>> np.power(100, 100, dtype=np.float64) 1e+200