Authentic Society
Authentic Society
Pretty-decent quality content delivered via simple article format.
Sign In | Create Account
Discussion ()
Show Random Page

C++: The difference between an int and a float

From Authentic Society, the Free Learning Website.
We are also a social network: Join the new interest-based social network to meet people who share the same interests.
Category likeness to » C++. Added to Authentic Society 44 years ago.
Estimated reading timeEstimated reading time0 minutes 56 seconds (based on 189 words and 200wpm reading speed)

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)



contact
Authentic Society believes in free, original and pretty-decent quality content delivered via simple article format.
If you enjoy the quality of content on this page, have edit suggestions, improvements, questions, comments or business collaborations
feel welcome to reach me by email greg.sidelnikov@gmail.com - Thanks :-)

2006-2011 Articles and Tutorials Copyright Authentic Society.

Privacy Policy | Legal Notice

Help us grow our community! We are also a social network: Join the new interest-based social network to meet people who share the same interests.