+ 1
what exactly is a float?
5 ответов
+ 4
well a float is a number like this one : 89.432 (it's not a whole number) ,but it cannot store as much data as a double because "float" is a 32 bit number so it can store 2 to the power of 32 numbers (between 4,294,967,296 and -4,294,967,296) , doubles are 64 bit numbers and they can store a lot more. Now you might ask why is it important? Well these was a problem for a lot of games , like Star Citizens or Kerbal Space Program , where the maps were so huge that the developers needed bigger numbers to store the player location because if they went to far away from the center of the universe (0,0,0) then stuff would start to look like it's disassembled even if it isn't .For instance the first part of the ship is at the location 10 and the next part of the ship is at 11 but they need to be closer to each other,and yes I do know in this example they would be able to put the second part at 10.5 for example but imagine that the numbers just don't allow you to do that. If you didn't got that imagine walking on a huge planet and the gun you re holding start to clip through your hands and then you walk more and the gun is at 10 meters in front of you.
+ 1
float excepts decimal numbers
0
If int is a whole number,
then foat is a Decimal Number.
0
thx ppl
- 1
its a floating point number. but it is better to use a double