473,387 Members | 1,407 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 855

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Eric Newton | last post by:
come on framework guys ;-) probably an oversight but lets fix it and get a simple default comparer into v1.2? ...
1
by: sho_nuff | last post by:
Hello all, I have a sorted list that contains items: foo1 foo2 foo3 foo10 foo11 foo12
0
by: Frank Wisniewski | last post by:
Hi All, I have created my own generic comparer object which implements IComparer and uses reflection. I have tested it and it seem to work fine but I am worried about the way I did it. My goal...
14
by: jojoba | last post by:
Hi, I hope this post is ok for this group. Here's my deal: I have two computers on my LAN at home. One desktop. One laptop. Both computers are wireless enabled (and wired enabled too). I...
2
by: cindy | last post by:
i build a string string eProduct = "#blah#ablah#bbbb"; StringBuilder sb = new StringBuilder(eProduct); eProduct = sb.Replace("#","").ToString(); string aProducts= eProduct.Split(';'); then I...
2
by: tommaso.gastaldi | last post by:
Hi, I need to change at runtime the Comparer of a SortedList of mine (it does not seem to expose a Comparer or Icomparer property). Do you know how can I do that (clearly without reconstructing...
2
by: Luc The Perverse | last post by:
Hello! I am trying to find a way to deal with Windows' case insensitivity without just forcing everything lowercase. While I am open to criticism on my method - my question relates to the...
3
by: radom | last post by:
How do i use the Comparer fuction thanks radom
6
by: Tony | last post by:
Hello! My first question: I just can't figure out what is the usefulness of Comparer.Default.Compare(somestring1, somestring2); because I can just the same use...
10
by: Tony | last post by:
Hello! I'm reading in a book and this can't be correct it says. "Objects passed to Comparer.Compare() are checked to see if they support IComparable. If they do, then that implementation is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.