Difference between Python float and numpy float32
What is the difference between the built in float
and numpy.float32
?
Example
a = 58682.7578125
print type(a)
print a
print type(numpy.float32(a))
print numpy.float32(a)
Output:
<type 'float'>
58682.7578125
<type 'numpy.float32'>
58682.8
I've found here that numpy.float32
is:
float32 Single precision float: sign bit, 8 bits exponent, 23 bits mantissa
didn't find what the built in float
format is.
Solution 1:
Python's standard float
type is a C double
: http://docs.python.org/2/library/stdtypes.html#typesnumeric
NumPy's standard numpy.float
is the same, and is also the same as numpy.float64
.