• Create Account

#ActualiMalc

Posted 11 October 2012 - 01:01 AM

Just wanted to chime in, probably a bit late but anyway. Floating point variables have a range of something like 1234510. Although this is difficult to place actual range of numbers to it is important to remember that floating point variables are normally used for positions, velocities and other 3D calculations. It is very rare that you will ever encounter a level map, model, mesh or really any 3D asset that even comes close to peaking out the maximum allowable values of a float.

With all of that said I understand that many coders think bigger is better and that using a double in place of a float will give you the ability to have larger maps, worlds, more precision in game and all that jazz. However that is simply untrue, video cards themselves fall flat on their face when you get anywhere near those sizes. So I guess in short, I would suggest coders just be in the habit of using floats unless there is some extenuating circumstance wherein you actually do need the extra range.

Range is not everything; You have completely side-stepped the issue of precision. So either you aren't aware of how floating point works, or you're conveinently only telling half of the story to make it seem more convincing.

Floats are essentially scientific notation.
The larger your float value is, the less precise it is. With IEEE754 floats, all decimal precision is completely gone at by the time you reach 8388608.
From there is only gets worse. if you add 16777216.f and 1.f for example, you get 16777216 again! For proof, test the following assert:
assert(16777216.f + 1.f != 16777216.f);
Mathematically you would certainly excpect the result of adding one 1 to have an effect, but it doesn't because 16777217.f can't be represented.

For many things, you need much more precision than that well before you get that high. Floats just don't provide that.

Don't get me wrong though, floats are still very very useful in a lot of cases. I even have a C++ class that provides fully IEEE754 compliant 16-bit "half" floats, at close to the speed of regular floats, for when saving memory is of the utmost importance.

But... it's just not as cut and dry as you make it out to be.

#2iMalc

Posted 11 October 2012 - 01:01 AM

Just wanted to chime in, probably a bit late but anyway. Floating point variables have a range of something like 1234510. Although this is difficult to place actual range of numbers to it is important to remember that floating point variables are normally used for positions, velocities and other 3D calculations. It is very rare that you will ever encounter a level map, model, mesh or really any 3D asset that even comes close to peaking out the maximum allowable values of a float.

With all of that said I understand that many coders think bigger is better and that using a double in place of a float will give you the ability to have larger maps, worlds, more precision in game and all that jazz. However that is simply untrue, video cards themselves fall flat on their face when you get anywhere near those sizes. So I guess in short, I would suggest coders just be in the habit of using floats unless there is some extenuating circumstance wherein you actually do need the extra range.

Range is not everything; You have completely side-stepped the issue of precision. So either you aren't aware of how floating point works, or you're conveinently only telling half of the story to make it seem more convincing.

Floats are essentially scientific notation.
The larger your float value is, the less precise it is? With IEEE754 floats, all decimal precision is completely gone at by the time you reach 8388608.
From there is only gets worse. if you add 16777216.f and 1.f for example, you get 16777216 again! For proof, test the following assert:
assert(16777216.f + 1.f != 16777216.f);
Mathematically you would certainly excpect the result of adding one 1 to have an effect, but it doesn't because 16777217.f can't be represented.

For many things, you need much more precision than that well before you get that high. Floats just don't provide that.

Don't get me wrong though, floats are still very very useful in a lot of cases. I even have a C++ class that provides fully IEEE754 compliant 16-bit "half" floats, at close to the speed of regular floats, for when saving memory is of the utmost importance.

But... it's just not as cut and dry as you make it out to be.

#1iMalc

Posted 11 October 2012 - 12:56 AM

Just wanted to chime in, probably a bit late but anyway. Floating point variables have a range of something like 1234510. Although this is difficult to place actual range of numbers to it is important to remember that floating point variables are normally used for positions, velocities and other 3D calculations. It is very rare that you will ever encounter a level map, model, mesh or really any 3D asset that even comes close to peaking out the maximum allowable values of a float.

With all of that said I understand that many coders think bigger is better and that using a double in place of a float will give you the ability to have larger maps, worlds, more precision in game and all that jazz. However that is simply untrue, video cards themselves fall flat on their face when you get anywhere near those sizes. So I guess in short, I would suggest coders just be in the habit of using floats unless there is some extenuating circumstance wherein you actually do need the extra range.

Range is not everything. you have completely side-stepped the issue of precision. So either you aren't aware of how floating point works, or you're conveinently only telling half of the story to make it seem more convincing.

Floats are essentially scientific notation.
The larger your float value is, the less precise it is? With IEEE754 floats, all decimal precision is completely gone at by the time you reach 8388608.
From there is only gets worse. if you add 16777216.f and 1.f for example, you get 16777216 again! For proof, test the following assert:
assert(16777216.f + 1.f != 16777216.f);
Mathematically you would certainly excpect the result of adding one 1 to have an effect, but it doesn't because 16777217.f can't be represented.

For many things, you need much more precision than that well before you get that high. Floats just don't provide that.

Don't get me wrong though, floats are still very very useful in a lot of cases. I even have a C++ class that provides fully IEEE754 compliant 16-bit "half" floats, at close to the speed of regular floats, for when saving memory is of the utmost importance.

But... it's just not as cut and dry as you make it out to be.

PARTNERS