471,310 Members | 1,042 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

Re: Color comparer mystery

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
0 803

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by sho_nuff | last post: by
reply views Thread by Frank Wisniewski | last post: by
2 posts views Thread by tommaso.gastaldi | last post: by
2 posts views Thread by Luc The Perverse | last post: by
10 posts views Thread by Tony | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.