Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coding - Comparison test gone wrong?
#4
Kalovale Wrote:The question now is how do I know beforehand that something this simple (decrement step by 0.1) is going to run into this problem? Should I always do the (different > epsilon) check instead of (difference = 0) check?

You'll pretty much want to use >= or <= for floating-point compares in place of ==. Integer is fine to use ==, though.
Reply


Messages In This Thread
Coding - Comparison test gone wrong? - by Nikkey - 2011-11-29, 05:40 PM
Coding - Comparison test gone wrong? - by sicnarf - 2011-11-29, 08:12 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)