Question: I am having a lot of confusion using the `sys.getsizeof` function in python. All I want to find out is that for say a floating point value, is the system using 4 or 8 bytes (i.e. single or double precision in C terms).

I do the following:

```
import sys

x = 0.0
sys.getsizeof(x)  # Returns 24

type(x) # returns float

sys.getsizeof(float)  # Returns 400.

```

How can I simply find out the how many bytes are actually used for the floating point representation. I know it should be 8 bytes but how can I verify this (something like the `sizeof` operator in C++)

Answer: 
```
import ctypes
ctypes.sizeof(ctypes.c_double)

```
From [the docs](https://docs.python.org/3/library/sys.html#sys.getsizeof):

> 
> getsizeof() calls the object’s **sizeof** method and adds an additional garbage collector overhead if the object is managed by the garbage collector.
> 
> 
> 

`sys.getsizeof` is not about the byte size as in C.

For `int` there is [`bit_length()`](https://docs.python.org/3/library/stdtypes.html#int.bit_length).