Name: Anonymous 2013-07-14 1:36
What's the biggest value that a float can hold while still preserving 1.0 of precision?
e.g. suppose I have:
float l = xxxxx;
l += 1.0;
If xxxxx is large enough, the second line (l += 1.0) won't change it's value, due to the nature of floating point arithmetics. My question is: how big xxxxx must be for this to happen?
And I know that the C++ standard isn't clear in regards to the size of each data type, but let's assume that sizeof(float) is 4 bytes or 32 bits, and that the IEEE standard on floating point arithmetics is followed (as occurs in g++/VC++).
This is relevant for me since I am writing an Minecraft clone, and I want to know how big can the map be before the whole thing crashes spectacularly (each block is 1x1x1).
e.g. suppose I have:
float l = xxxxx;
l += 1.0;
If xxxxx is large enough, the second line (l += 1.0) won't change it's value, due to the nature of floating point arithmetics. My question is: how big xxxxx must be for this to happen?
And I know that the C++ standard isn't clear in regards to the size of each data type, but let's assume that sizeof(float) is 4 bytes or 32 bits, and that the IEEE standard on floating point arithmetics is followed (as occurs in g++/VC++).
This is relevant for me since I am writing an Minecraft clone, and I want to know how big can the map be before the whole thing crashes spectacularly (each block is 1x1x1).