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



You are viewing an
Authentic Society Atom

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)



What is Authentic Society? (preview picture)
What is Authentic...


Blogging about Blogging (preview picture)
Blogging about Blo...


Recreational Blogging (preview picture)
Recreational Blogg...


Blogging for Money - How to Successfully Monetize Your Blog (preview picture)
Blogging for Money...


Custom Presentation Folders (preview picture)
Custom Presentatio...


Blog Content Manipulation - A Critique (preview picture)
Blog Content Manip...


Blogging: Relevancy of Content and the Mistake of Misleading Target Audience (preview picture)
Blogging: Relevanc...


2009. A New Year and 2008 Site Statistics Overview (preview picture)
2009. A New Year a...


Computer Programmer Job Description (preview picture)
Computer Programme...


C++: The difference between an int and a float (preview picture)
C++: The differenc...
Other :

What is Authentic Society? (preview picture)
What is Authentic...


Blogging about Blogging (preview picture)
Blogging about Blo...


Recreational Blogging (preview picture)
Recreational Blogg...


Blogging for Money - How to Successfully Monetize Your Blog (preview picture)
Blogging for Money...


Custom Presentation Folders (preview picture)
Custom Presentatio...


Blog Content Manipulation - A Critique (preview picture)
Blog Content Manip...


Blogging: Relevancy of Content and the Mistake of Misleading Target Audience (preview picture)
Blogging: Relevanc...


2009. A New Year and 2008 Site Statistics Overview (preview picture)
2009. A New Year a...


Computer Programmer Job Description (preview picture)
Computer Programme...


Learning C++, Tutorial Introduction (preview picture)
Learning C++, Tuto...


Don't miss the next article

Subscribe to the feed on this subject

Authentic Society invites you to learn more about

Receive an e-mail every time a quality article is posted here

E-mail Address:

Delivered by FeedBurner