A float was something that used to really puzzle me. It was never properly explained on the video tutorials I used to follow when trying to pick up C. It used to constantly stump me and every definition I ever looked at just over-complicated the matter even further. For anyone else who is also baffled by a float, your misery ends below.
A float is literally just a number with a decimal point... Thats it.
The term float is an abbreviation of a floating point number. Floating point refers to the decimal point being able to 'float' between the digits of a number being defined. Simple really but if you follow the Wikipedia link you will see how unnecessarily over-the-top their definition becomes... well I take that back their definition is very precise and proper its just very hard to understand if you don't have a good backing in mathematics, which we all (aspiring computer scientists) should really have.
yep...
Just a little bit more information from me that I believe will help you; an integer can only hold single values and the way an integer is stored in your computers memory is different from a decimal number. A number with a decimal point is slightly more complicated to store and it therefore requires more space in the computer's memory than a plain integer. If you are trying to make efficient programs a little tip I learnt is that floats take up a a fair bit more memory in comparison to an integer so if every byte counts try and use integers rather than floats. Peace out and best of luck for your studying this year.
No comments:
Post a Comment