>>> x=float(12.345)
>>> x
12.345
>>> sys.getsizeof(x)
16
>>> sys.getsizeof(12.345)
16
Here 16 is of the unit of byte? But in the document it's of 64 bits the float
python 3.5.1 32bits Windows 7 64
>>> x=float(12.345)
>>> x
12.345
>>> sys.getsizeof(x)
16
>>> sys.getsizeof(12.345)
16
Here 16 is of the unit of byte? But in the document it's of 64 bits the float
python 3.5.1 32bits Windows 7 64
sys.getsizeof()
returns the memory size of an instance of the float
type. In addition to the 8 bytes used by the 64-bit IEEE representation of a float, additional memory is used for reference count, a pointer to type information, etc.
The memory space consumed by a python variable depends on the what version of python you have ie. 32 bit or 64 bit platform.
Coming to float representation. A float in 32 bit python consumes 16 bytes of memory while for 64 bit it consumes 24 byte of memory.