# Thread: basic c++ variable types, digits of precision etc

1. ## basic c++ variable types, digits of precision etc

Hi

Please have a look on this table:
http://img192.imageshack.us/img192/4...ledatatype.jpg

"int" is system dependent and on 32-bit system occupies four bytes. As there are 8 bits in one byte therefore there are total 32 bits. If 2 is raised to the power of 32, 2^(32), it comes to 4294967296 which is equal to combined numerical range of int (2,147,483,648 + 2,147,483,647). The same is true for other variable types except "float" and "double". Why is so?

Is "float" also system dependent like "int?

What does the digits of precision, 7 and 15, for "float" and "double" respectively mean? Does this mean decimal point is followed by 7 and 15 digits respectively?

It would be very nice of you if you would help me with the above queries. Please keep the things simple.

Regards
Jackson

2. > Is "float" also system dependent like "int?
Yes, but variation is less common. The C standard follows what IEEE defines, which in turn is what comes available in hardware FPU's. There is always scope to implement a float with more bits allocated to it, but it would be a lot of work for the implementer.

> Does this mean decimal point is followed by 7 and 15 digits respectively?
No, it means the left-most N digits (regardless of the decimal point)
So
123456789
123.456789
0.000123456789

3. The floating point variables have a more complex representation. But if you study how they are represented you can then understand where those numbers come from.

4. Floating point essentially uses scientific notation.