By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,458 Members | 1,299 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,458 IT Pros & Developers. It's quick & easy.

Re: Color comparer mystery

P: n/a
On Thu, 03 Jul 2008 08:54:46 -0700, Andrew <so*****@nospam.comwrote:
[...]
Why would the float variables get different values between the "Debug"
and
"Release" builds?
I don't know the precise answer. But it's not surprising at all to me
that there may be subtle differences in floating point behavior between
the two versions. Doing identity comparisons between floating point
values is almost never the right approach, and your experience
demonstrates why.

I think that your solution, converting to integers and then comparing
that, is a perfectly reasonable approach, especially given the problem
domain. You could also have compared the difference between two floating
point values and considered them equal as long as the difference was small
enough. That's a fairly common approach in other scenarios using floating
point, but in this case it's probably overkill.

Pete
Jul 3 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.