C++: The difference between an int and a float
DISCUSSAGREEDISAGREEEARN AUTHORITYDISCOVER NEW THINGS BASED ON YOUR INTERESTS
|
0 Comments:
There are numerous C++ books you can learn these things from! But Data Type is related to the amount of space allocated to store data AND also how it is represented within that space. All data types equal a certain number of bits. For example, an int and a float consist of the same number of bits on a 32-bit Windows-based Intel processor. Data types may vary from one machine to another machine. In the case of an int and a float, on a 32-bit processor, they both hold 4 bytes (or 32 bits), but the memory representation is what is different. An int holds the sign (+/-) in the first bit, and the other 31 bits represent the actual integer number (a whole number). This is almost obvious. But a float holds 1 bit for the sign (+/-), 8 bits for the exponent part (the 1 in 1.256) and 23 bits for the fraction part (the 256 in 1.256) |
|
Authentic Society invites you to learn more about
Receive an e-mail every time a quality article is posted here
End of page
