+ 1

explain Float please, with examples

I hop this app still gets answers. for float, I know its for a floating variable, but what does that mean? what action does a floating variable take when called on? is it a number that never alters? is always there? what is it? why choose float for numbers instead of int?

31st Dec 2016, 12:40 AM
Ryan Rockwell
Ryan Rockwell - avatar
1 Odpowiedź
+ 2
A floating-point number can represent a decimal number, such as '1.23', while an integer can only represent whole numbers, such as '123'. The choice of which to use often depends on what the variable represents. For instance: * A variable used as a counter is typically an integer * A variable used to store a distance (or other measurement) is typically a float or double. See: http://stackoverflow.com/questions/7524838/fixed-point-vs-floating-point-number
31st Dec 2016, 4:20 AM
Nathan
Nathan - avatar