Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In C or C++, does the compiler option of floating point precision really make a difference in real world (small/indie) games?

From my observations, setting fp:fast is many times faster than fp:precise and from what I understand here ( http://stackoverflow.com/questions/6889522/fpfast-vs-fpprecise-what-kind-of-errors-can-i-encounter ) the precision difference between the two compiler options only changes from the 16th digit of a floating point number.

Has anyone encountered an example when using fp:fast went terribly wrong for 2D or 3D games?

Edit: To clarify, I am not asking about the precision of floating point values themselves (ie. float vs double vs decimal). Only about precision related to the compiler option.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Your interpretation of fp:fast vs fp:precise sounds suspicious; I'm sure there's more of an effect than just rounding error after the 16th decimal place. I refer you to Bruce Dawson's article on floating point precision for more details.

In general, floating-point precision error is definitely a real problem in game development. It's especially troublesome for physics programmers and for games with large worlds or long running times (on the order of weeks or months, like an MMO). Floating point precision errors most often manifest as simulation instability and jittery movement that gradually gets worse over time. If you're not seeing those sorts of artifacts in your game, and the performance increase is significant, then it should definitely be safe to stick with fp:fast.

share|improve this answer
    
-1 Floating point precision is not a major problem in game development. Choosing wrong data types and lack of numerical knowledge and algorithms is the cause of all the problems mentioned in this post. All projects I participated used fp:fast with none of the problems mentioned. –  Maik Semder Aug 24 '12 at 9:23
    
Yes, our conclusions are the same. My point was that floating point precision can be a problem in certain areas of game development, and that's why (in those areas) you need the numerical knowledge and proper data types you mentioned. –  postgoodism Aug 24 '12 at 16:04
    
+1 for both great link, and for the answer you gave maik semder. I've also seen people struggling with those kind of errors, simply because they don't know what kind of operations they should use in their codes. –  Ali.S Aug 24 '12 at 22:09
    
@postgoodism Thanks for answering. Not ignoring your input. Just may wait another day or two to see if I get more responses. –  Inisheer Aug 25 '12 at 6:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.